[Android] Use app context for media parsing notifications

Geoffrey Métais git at videolan.org
Fri Feb 8 16:22:51 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  8 15:25:33 2019 +0100| [200c1ed843a92dd98dcab993429a4f411ec761f6] | committer: Geoffrey Métais

Use app context for media parsing notifications

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index a8e4e751a..5789d9098 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -139,8 +139,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
     }
 
     private fun forceForeground() {
-        val ctx = this at MediaParsingService
-        val notification = NotificationHelper.createScanNotification(ctx, getString(R.string.loading_medialibrary), false, scanPaused)
+        val notification = NotificationHelper.createScanNotification(applicationContext, getString(R.string.loading_medialibrary), false, scanPaused)
         startForeground(43, notification)
     }
 
@@ -285,7 +284,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope {
             val updateAction = wasWorking != medialibrary.isWorking
             if (updateAction) wasWorking = !wasWorking
             if (!isActive) return at withContext ""
-            val notification = NotificationHelper.createScanNotification(this at MediaParsingService, progressText, updateAction, scanPaused)
+            val notification = NotificationHelper.createScanNotification(applicationContext, progressText, updateAction, scanPaused)
             if (lastNotificationTime != -1L) {
                 try {
                     startForeground(43, notification)



More information about the Android mailing list