[Android] Fix media parsing service notification actions not working on Android 14
Nicolas Pomepuy
git at videolan.org
Fri Nov 17 13:29:30 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Nov 17 11:27:34 2023 +0100| [4aeb7f4632909471fcd172b2869323971b1da46f] | committer: Nicolas Pomepuy
Fix media parsing service notification actions not working on Android 14
> https://code.videolan.org/videolan/vlc-android/commit/4aeb7f4632909471fcd172b2869323971b1da46f
---
.../src/org/videolan/vlc/gui/helpers/NotificationHelper.kt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.kt
index 8e89ac4f80..8f6d95e709 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.kt
@@ -36,7 +36,15 @@ import androidx.core.app.NotificationCompat
import androidx.core.content.getSystemService
import androidx.media.session.MediaButtonReceiver
import org.videolan.libvlc.util.AndroidUtil
-import org.videolan.resources.*
+import org.videolan.resources.ACTION_PAUSE_SCAN
+import org.videolan.resources.ACTION_RESUME_SCAN
+import org.videolan.resources.AndroidDevices
+import org.videolan.resources.AppContextProvider
+import org.videolan.resources.CUSTOM_ACTION
+import org.videolan.resources.CUSTOM_ACTION_BOOKMARK
+import org.videolan.resources.CUSTOM_ACTION_SPEED
+import org.videolan.resources.EXTRA_CUSTOM_ACTION_ID
+import org.videolan.resources.START_ACTIVITY
import org.videolan.tools.DrawableCache
import org.videolan.tools.Settings
import org.videolan.tools.getContextWithLocale
@@ -160,6 +168,7 @@ object NotificationHelper {
scanCompatBuilder.setContentText(progressText)
notificationIntent.action = if (paused) ACTION_RESUME_SCAN else ACTION_PAUSE_SCAN
+ notificationIntent.`package` = ctx.packageName
val pi = PendingIntent.getBroadcast(ctx.applicationContext.getContextWithLocale(AppContextProvider.locale), 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
val playpause = if (paused)
NotificationCompat.Action(R.drawable.ic_play_notif, ctx.getString(R.string.resume), pi)
More information about the Android
mailing list