[Android] Use correct classnames to stop services

Geoffrey Métais git at videolan.org
Fri Jan 24 09:13:18 CET 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 23 14:43:47 2020 +0100| [a88d1bdba85d3e4ec3a353462bb74b6fecac34df] | committer: Nicolas Pomepuy

Use correct classnames to stop services

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 4 ++--
 vlc-android/src/org/videolan/vlc/PlaybackService.kt     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 0ab085eee..c3fa0c4db 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -138,7 +138,7 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb, LifecycleOwn
         val pm = applicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager
         wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VLC:MediaParsigService")
 
-        if (lastNotificationTime == 5L) stopService(Intent(applicationContext, MediaParsingService.javaClass))
+        if (lastNotificationTime == 5L) stopService(Intent(applicationContext, MediaParsingService::class.java))
         Medialibrary.getState().observe(this, Observer<Boolean> { running ->
             if (!running && !scanPaused) {
                 exitCommand()
@@ -392,7 +392,7 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb, LifecycleOwn
             }
             notificationActor.offer(Hide)
             stopForeground(true)
-            stopService(Intent(applicationContext, MediaParsingService.javaClass))
+            stopService(Intent(applicationContext, MediaParsingService::class.java))
         }
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 8b74eb6d0..d4adcbc24 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -999,7 +999,7 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
         if (AndroidDevices.isAndroidTv) return
         scope.launch {
             awaitMedialibraryStarted()
-            if (!playlistManager.loadLastPlaylist()) stopService(Intent(applicationContext, PlaybackService.javaClass))
+            if (!playlistManager.loadLastPlaylist()) stopService(Intent(applicationContext, PlaybackService::class.java))
         }
     }
 



More information about the Android mailing list