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

Add flag immutable for intent #849

Merged

Conversation

valentin-debris
Copy link
Contributor

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

This is a bug fix for make the plugin compatible with Android 12. It requires now FLAG_IMMUTABLE (or MUTABLE) for every PendingIntent.GetActivity(), otherwise, it fails to load the app.

⤵️ What is the current behavior?

The app crashes as soon as it starts, with the error
"Caused by: java.lang.IllegalArgumentException: fr.magina.radioperfecto: 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."

🆕 What is the new behavior (if this is a feature change)?

No more crash !

💥 Does this PR introduce a breaking change?

No, it's backward compatible

🐛 Recommendations for testing

📝 Links to relevant issues/docs

#845

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines
  • Relevant documentation was updated
  • Rebased onto current develop

@martijn00 martijn00 merged commit 0c4487b into Baseflow:develop Feb 18, 2022
@valentin-debris valentin-debris deleted the fix/android12-flag-immutable branch February 21, 2022 13:44
@ghost
Copy link

ghost commented Mar 19, 2022

Hi @martijn00 ! Any plans on when this will be in a nuget update?

@floriantanneur
Copy link

Hello @martijn00, Any news on this update ?
Thanks.

janwiebe-jump added a commit to janwiebe-jump/XamarinMediaManager that referenced this pull request Mar 22, 2022
@hberrio
Copy link

hberrio commented Aug 8, 2022

Hi @martijn00, Any news on this update?

@abreucruz
Copy link

hi @martijn00 do you have any updated package? for API 31+ with Samsung it's not working anymore in order to play an audio I have to use API 30 as a target but Google is only accepting API 31+ so my App it's not playing any Audios on Samsung devices.

@okains
Copy link

okains commented Nov 27, 2022

there is a patch / hack that will get this working in 12+, just explicitly set the speed to 1 before playing the audio, that will get you past this issue for now. This is documented in another ticket, can't find the reference but that's the gist of it.

float speed = 1;

CrossMediaManager.Current.Speed = speed;

await CrossMediaManager.Current.Play(AudioTrackUrl);

@abreucruz
Copy link

hi @okains I just did what you mentioned and I'm getting this error:
MediaSession cannot be null. Make sure the MediaBrowserService sets it up Parameter name: MediaSession

Note: I changed Target Android version to API 31(New requirement from Google). Apparently the component failed to Init but I'm not getting any error during init process.

@okains
Copy link

okains commented Nov 28, 2022

@abreucruz

Make sure that you have called init on the MediaSession instance in App:
CrossMediaManager.Current.Init();

@abreucruz
Copy link

@okains Yes thanks I did, my code works fine on API 30 but as soon I change it to API 31 the Play method does not works.

@abreucruz
Copy link

Hello @okains any other ideas? I'm struggling with this issue since a week ago and the only issue is that google now require API 31+ for new App updates and with this version the Nuget Package does not work properly

mattdreiss pushed a commit to lampo/XamarinMediaManager that referenced this pull request Oct 10, 2023
…ag-immutable

Add flag immutable for intent
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

Successfully merging this pull request may close these issues.

None yet

6 participants