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

Cross Media Manager Init issue when change the android target SDK to 31 - mutability flag #845

Closed
3 tasks
pasha-o opened this issue Dec 25, 2021 · 11 comments
Closed
3 tasks

Comments

@pasha-o
Copy link

pasha-o commented Dec 25, 2021

🐛 Bug Report

As soon as I updated the android target SDK to 31(Android S), a Missing PendingIntent mutability flag appeared on the line
CrossMediaManager.Current.Init(this)

Java.Lang.IllegalArgumentException Message=[] 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.

Expected behavior

should work without throwing an exception

Reproduction steps

change the target to target SDK to 31(Android S)
compile and run

Configuration

Version: 1.0.9

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🐒 Xamarin.Forms
@pasha-o pasha-o changed the title Cross Media Manager Init issue when change the android target SDK to 31 Cross Media Manager Init issue when change the android target SDK to 31 - mutability flag Dec 25, 2021
@DetlefSauerbrei
Copy link

DetlefSauerbrei commented Feb 15, 2022

Having the same issue. After updating device to API 31, all apps that use Mediamager crash while CrossmediaManager.Current.Init() is called.
To reproduce simply run any app using Mediamanager.Forms on emulator or device running Android 12.

@valentin-debris
Copy link
Contributor

I confirm the error comes from this plugin for my app, I removed the nuget and imported directly the code in my app, and when I starts the app, it shows me the error in MediaManager/Platforms/Android/MediaManagerImplementation.cs, line 95. I added "PendingIntentFlags.Immutable" instead of the last 0 and now it works.

So @martijn00 , can you provide a new version (/!\ it needs to be backward compatible, as the flag only exists since API 23) with this fix soon, as it will impact everyone as soon as they update to Android 12 ?

Thanks

@valentin-debris
Copy link
Contributor

Hi @martijn00 , when do you think the new version of the nugget with this fix will be available ?

Regards

@abdu292
Copy link

abdu292 commented Feb 26, 2022

@martijn00 A release with this fix would be much appreciated.

@valentin-debris Thanks for the fix!

@vincentchunwei
Copy link

Hi @valentin-debris , I directly the code in my app too, but when I play the audio on Android 12, that doesn't have any sound. Did you occurred this problem?

@pasha-o
Copy link
Author

pasha-o commented Apr 15, 2022

hi, @martijn00 I opened this ticket in 2021, a simple compile shouldn't take this long for it to work on android 12 - any update on the nugget?

@pasha-o
Copy link
Author

pasha-o commented May 7, 2022

Hi @martijn00 is the issue fixed when you closed it? Is there a releasable nuget?

@vincentchunwei
Copy link

Hi @martijn00 , when I update to 1.1.1 version, I can't still hear any sound when I play the audio on Android 12. Did you ever occur this problem?

@gamertrumpfi
Copy link

gamertrumpfi commented May 9, 2022

the same issue was occuing for me @vincentchunwei . It now actually woked for me. I had one android 11 targeting xamarin csproj left and after that was raised to 12 i could hear audio again

@DetlefSauerbrei
Copy link

DetlefSauerbrei commented May 9, 2022 via email

@lobons
Copy link

lobons commented May 11, 2022

Hi @martijn00 after updating to version 1.1.1 I'm able to play the video on Android 12 only with a "trick" on debug mode (can't find a way for release) :
Set a breakpoint and exploding "CrossMediaManager.Current.*" to look the properties , at that moment if I click on "continue" the streaming starts.
There's no other way that worked for me on Android 12; the same code that doesn't work with 12 is working great with Android 11,10 and 9 and also with iOS.

I attach a short video to show what I mean with "trick"...
https://user-images.githubusercontent.com/52449396/167838864-0ad037dc-99f5-41b0-a845-1d876cf9cb05.mp4

Anyone can help with this??

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

8 participants