Skip to content

Android12 raises a Exception with onPushReceive #1137

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

Closed
4 tasks done
junya100 opened this issue Oct 31, 2021 · 4 comments · Fixed by #1139
Closed
4 tasks done

Android12 raises a Exception with onPushReceive #1137

junya100 opened this issue Oct 31, 2021 · 4 comments · Fixed by #1139
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@junya100
Copy link

junya100 commented Oct 31, 2021

New Issue Checklist

Issue Description

 The following exception is raised with Android12 when onPushReceive is called.
 And targetSDKVersion is 31.

 Caused by: java.lang.IllegalArgumentException: my.package: 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 com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:430)
    at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:168)

Steps to reproduce

Call ParsePushBroadcastReceiver#onPushReceive method.

Actual Outcome

Caused by: java.lang.IllegalArgumentException: my.package: 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 com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:430)
at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:168)

Expected Outcome

No exception.

Environment

any Parse Android SDK version with Android12 and targetSDKVersion 31

Parse Android SDK

  • SDK version: 2.0.3
  • Operating system version: Android12

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 31, 2021

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@azlekov azlekov added severity:high type:bug Impaired feature or lacking behavior that is likely assumed labels Nov 3, 2021
@azlekov
Copy link
Contributor

azlekov commented Nov 3, 2021

According to the docs Android 12 enforce mutability flag for each pending intents. I will check this and open a PR.

@parseplatformorg
Copy link

🎉 This change has been released in version 2.0.6

@parseplatformorg parseplatformorg added the state:released Released as stable version label Nov 16, 2021
@parse-github-assistant
Copy link

The label state:released cannot be used in combination with state:needs-investigation.

@parse-github-assistant parse-github-assistant bot removed the state:released Released as stable version label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants