Baseflow / XamarinMediaManager

Cross platform Xamarin plugin to play and control Audio and Video
https://baseflow.com
MIT License
761 stars 304 forks source link

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. #892

Open abdoutech93 opened 1 year ago

abdoutech93 commented 1 year ago

🐛 Bug Report

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Java.Lang.IllegalArgumentException: com.xxx.app: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
  at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00088] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:12324 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.FinishCreateInstance (System.String constructorSignature, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0003e] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:174 
  at Android.Support.V4.Media.Session.MediaSessionCompat..ctor (Android.Content.Context context, System.String tag) [0x0008a] in D:\a\1\s\generated\androidx.media.media\obj\Release\monoandroid9.0\generated\src\Android.Support.V4.Media.Session.MediaSessionCompat.cs:1651 
  at MediaManager.Platforms.Android.MediaSession.MediaBrowserService.PrepareMediaSession () [0x00001] in D:\xxxMobileApp\Lib\XamarinMediaManager-patch\MediaManager\Platforms\Android\MediaSession\MediaBrowserService.cs:91 
  at MediaManager.Platforms.Android.MediaSession.MediaBrowserService.OnCreate () [0x00009] in D:\xxxMobileApp\Lib\XamarinMediaManager-patch\MediaManager\Platforms\Android\MediaSession\MediaBrowserService.cs:49 
  --- End of managed Java.Lang.IllegalArgumentException stack trace ---
java.lang.IllegalArgumentException: com.xxx.app: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
    at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
    at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
    at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:568)
    at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:538)
    at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:502)
    at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:476)
    at crc646e364d2ff34954e7.MediaBrowserService.n_onCreate(Native Method)
    at crc646e364d2ff34954e7.MediaBrowserService.onCreate(MediaBrowserService.java:35)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4487)
    at android.app.ActivityThread.access$1700(ActivityThread.java:247)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2072)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7839)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Expected behavior

playing HLS audio, any exception. notification not displayed.

Reproduction steps

exception in MediaManager here MediaManager\Platforms\Android\MediaSession\MediaBrowserService.cs:91 in the PrepareMediaSession function.

Configuration

TargetSDKVersion 31 Version: 1.1.1.0 branch patch for android 12

Platform:

martijn00 commented 1 year ago

Please make a PR

MartinRValdez commented 1 month ago

idem, any solution?