[Android] Use launchForeground everywhere

Nicolas Pomepuy git at videolan.org
Tue Nov 30 06:28:32 UTC 2021


vlc-android | branch: 3.4.x | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov 29 10:10:47 2021 +0100| [45ee3a184dbf4da596b280bfd40123901571683e] | committer: Nicolas Pomepuy

Use launchForeground everywhere

(cherry picked from commit 896748d50aa1f468603eda679c120cab61861d69)

> https://code.videolan.org/videolan/vlc-android/commit/45ee3a184dbf4da596b280bfd40123901571683e
---

 application/vlc-android/src/org/videolan/vlc/StartActivity.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
index 47edf7255..5498b2dc9 100644
--- a/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/StartActivity.kt
@@ -30,7 +30,6 @@ import android.os.Build
 import android.os.Bundle
 import android.provider.MediaStore
 import android.util.Log
-import androidx.core.content.ContextCompat
 import androidx.core.net.toUri
 import androidx.fragment.app.FragmentActivity
 import androidx.lifecycle.lifecycleScope
@@ -38,6 +37,7 @@ import kotlinx.coroutines.*
 import org.videolan.libvlc.util.AndroidUtil
 import org.videolan.medialibrary.MLServiceLocator
 import org.videolan.resources.*
+import org.videolan.resources.util.launchForeground
 import org.videolan.resources.util.startMedialibrary
 import org.videolan.tools.*
 import org.videolan.vlc.gui.BetaWelcomeActivity
@@ -151,7 +151,7 @@ class StartActivity : FragmentActivity() {
         } else if (MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH == action) {
             val serviceInent = Intent(ACTION_PLAY_FROM_SEARCH, null, this, PlaybackService::class.java)
                     .putExtra(EXTRA_SEARCH_BUNDLE, intent.extras)
-            ContextCompat.startForegroundService(this, serviceInent)
+            launchForeground(serviceInent)
         } else if (Intent.ACTION_VIEW == action && intent.data != null) { //launch from TV Channel
             val data = intent.data
             val path = data!!.path



More information about the Android mailing list