Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android target level api 31 #866

Closed
1 of 7 tasks
janwiebe-jump opened this issue Jun 22, 2022 · 15 comments
Closed
1 of 7 tasks

Support Android target level api 31 #866

janwiebe-jump opened this issue Jun 22, 2022 · 15 comments

Comments

@janwiebe-jump
Copy link
Contributor

janwiebe-jump commented Jun 22, 2022

🏗 Enhancement Proposal

As of August 31 all new apps must be at SDK target API level 31. Updates for existing apps have to be at level 31 as of November 2022 as stated here.
However, currently the MediaManager plugin doesn't support API level 31, mostly due to the dependency on ExoPlayer.Xamarin which binds against an older version of ExoPlayer that is not yet API level 31 ready. It uses the older way of creating the notification intent, without the correct PendingIntentFlags.

I have started the upgrade to the first version of ExoPlayer that supports Android 12 (version 2.14.2) on my fork
I got stuck updating the examples. Contributions welcome.

This might be a first start to get the MediaManager up to date and to help progress into a MAUI compatible library.

Pitch

Update the MediaManager to API level 31 to keep it in line with current Google Play requirements.

Platforms affected (mark all that apply)

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
@martijn00
Copy link
Member

@janwiebe-jump I've pulled your exoplayer work in and done a release, but it seems the SimpleExoplayer class, or the new ExoPlayer.Builder are removed from the bindings because of an error. I couldn't find a fix yet, but if you can i will release an update for it and for MediaManager.

@areimche
Copy link

Hello @martijn00,

Is there anything new regarding API Level 31 support? Is there already an update planned?

@ArchangelWTF
Copy link
Contributor

Hello @martijn00,

I've made a Pull Request that should fix the issues with ExoPlayer, could you pull this and make a release?

@martijn00
Copy link
Member

Yes, i'll do it as soon as i get a chance.

@BenDTU
Copy link

BenDTU commented Sep 20, 2022

Hi @martijn00 , is it possible to get a new release with these changes included?

@martijn00
Copy link
Member

There are more changes required to support the latest exoplayer. Feel free to make a PR!

@BenDTU
Copy link

BenDTU commented Sep 21, 2022

I’d be happy to give it a shot, how much needs to be done? Having a look it seems the logging provider needs to be swapped out at the very least, is there much else beyond that?

@copang
Copy link

copang commented Sep 27, 2022

I'm using version 1.1.1 and it can work with Android 12, however I noticed that it doesn't create player in notification manager like previous versions, this results in audio only being playable in background about 15-30m and then will be stopped. Is it a problem related to the latest ExoPlayer?
If so, I'm really looking forward to the new update.
Thank you guys so much!

@martijn00
Copy link
Member

@BenDTU I've updated to .net6 but there are some build errors remaining. Can you try to get it building?

@BenDTU
Copy link

BenDTU commented Oct 10, 2022

@martijn00 I'm seeing lots of errors relating to .Net 6, I assume other components XamarinMediaManager relies on aren't ready for that upgrade - I wouldn't know where to start to get that up to speed.

@martijn00
Copy link
Member

@BenDTU I'll work on replacing Forms with MAUI. Exoplayer is already updated to .net6 so if you can update the implementation of that?

@BenDTU
Copy link

BenDTU commented Oct 10, 2022

@martijn00 I can give it a shot when I have a chance, though I don't know how I'll go.

@martijn00
Copy link
Member

@BenDTU I've updated MAUI support and made it build. Just the sample doesn't work and there are some todo's

@copang
Copy link

copang commented Oct 11, 2022

@martijn00 so this new version will no longer support Xamarin right?
I'm having an issue with Android 12 and described it at #877, hope you can take a look.

@abdoutech93
Copy link

Player not loaded, notification not displayed also even with the android 12 patch branch and also with the android 12 2023 branch !!!

here is the error I'm getting :

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:\Devlopement\xxx\xx\src\xxxMobileApp\Lib\XamarinMediaManager-patch\MediaManager\Platforms\Android\MediaSession\MediaBrowserService.cs:91 
  at MediaManager.Platforms.Android.MediaSession.MediaBrowserService.OnCreate () [0x00009] in D:\Devlopement\xxx\xxx\src\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)
[Choreographer] Skipped 163 frames!  The application may be doing too much work on its main thread.
[OpenGLRenderer] Davey! duration=2749ms; Flags=0, FrameTimelineVsyncId=69913, IntendedVsync=19126012349465, Vsync=19128729016023, InputEventId=0, HandleInputStart=19128737532016, AnimationStart=19128737556516, PerformTraversalsStart=19128738214116, DrawStart=19128748697016, FrameDeadline=19126045682797, FrameInterval=19128737296016, FrameStartTime=16666666, SyncQueued=19128756498316, SyncStart=19128757157416, IssueDrawCommandsStart=19128757434616, SwapBuffers=19128760740016, FrameCompleted=19128762522816, DequeueBufferDuration=28800, QueueBufferDuration=893700, GpuCompleted=19128762376316, SwapBuffersCompleted=19128762522816, DisplayPresentTime=0, 
Message :Value cannot be null. 
Resolved pending breakpoint at 'RemoteGenericRepository.cs:52,1' to void xxxApp.Repository.RemoteGenericRepository.<GetAsync>d__2<xxxApp.Models.Mosque>.MoveNext () [0x00195].
Resolved pending breakpoint at 'RemoteGenericRepository.cs:52,13' to void xxxApp.Repository.RemoteGenericRepository.<GetAsync>d__2<T_REF>.MoveNext () [0x00195].
[Choreographer] Skipped 69 frames!  The application may be doing too much work on its main thread.
[EGL_emulation] app_time_stats: avg=721.57ms min=282.37ms max=1160.76ms count=2
[OpenGLRenderer] Davey! duration=1178ms; Flags=0, FrameTimelineVsyncId=69961, IntendedVsync=19128745682689, Vsync=19129895682643, InputEventId=0, HandleInputStart=19129910386616, AnimationStart=19129910427716, PerformTraversalsStart=19129910512616, DrawStart=19129911044416, FrameDeadline=19128779016021, FrameInterval=19129909707116, FrameStartTime=16666666, SyncQueued=19129915981716, SyncStart=19129916385616, IssueDrawCommandsStart=19129916516016, SwapBuffers=19129920810016, FrameCompleted=19129924707016, DequeueBufferDuration=605500, QueueBufferDuration=1356900, GpuCompleted=19129923157716, SwapBuffersCompleted=19129924707016, DisplayPresentTime=0, 
[EGL_emulation] app_time_stats: avg=161.63ms min=4.29ms ma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants