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

Android 12 PendingIntent Fix #477

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Paradox7208
Copy link

Android 12 is known to crash on launch if the Intent flag is not explicitly set to MUTABLE or IMMUTABLE.

Upon further testing, NFC tags would not scan when the App is in focus when the flag is set to IMMUTABLE. I decided to use the MUTABLE flag instead which is the default flag for a PendingIntent activity and NFC tags scan as normal.

https://developer.android.com/reference/android/app/PendingIntent#FLAG_MUTABLE
"Up until Build.VERSION_CODES.R, PendingIntents are assumed to be mutable by default, unless FLAG_IMMUTABLE is set. Starting with Build.VERSION_CODES.S, it will be required to explicitly specify the mutability of PendingIntents on creation with either FLAG_IMMUTABLE or FLAG_MUTABLE"

KINGS\ceadmin and others added 2 commits August 25, 2022 00:58
@MrElectroNick
Copy link

Hi @don, @krimple, @gonzalo123, @doncoleman - any updates on this?

@popovitsj
Copy link

Why is this checking for android.os.Build.VERSION_CODES.M (23) instead of S, which is 31?

@Paradox7208
Copy link
Author

@popovitsj that's a fair point. When I first put this fix together, I used code that I found in other similar forks of this project and pieced together the code seen in this pull request.

I am by no means an Android developer, my solution worked for me and it seems to work for others. Any improvements to the code is welcomed.

@popovitsj
Copy link

popovitsj commented Nov 14, 2022 via email

@Paradox7208
Copy link
Author

@popovitsj I agree, it would be better to target S as the requirement to explicitly state the PendingIntent flag was introduced in this API version. I suspect it would be considered a "breaking" change to suddenly start explicitly setting the PendingIntent flag for every API level.

rubenstolk added a commit to capptions/phonegap-nfc that referenced this pull request Nov 17, 2022
Copy link

@nickt26 nickt26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

perusworld added a commit to perusworld/phonegap-nfc that referenced this pull request Dec 13, 2022
Signed-off-by: Saravana Perumal Shanmugam <perusworld@linux.com>
@moustario moustario mentioned this pull request Dec 15, 2022
paolosanchi added a commit to paolosanchi/phonegap-nfc that referenced this pull request Jan 2, 2023
@PetervLeeuwen
Copy link

Any idea when this PR will be merged?

@laurensk
Copy link

Last commit to master was back in 2020. Is this plugin still maintained?

@Laith-Bzour90
Copy link

Laith-Bzour90 commented May 20, 2023

when this PR will be merged ?
this fix issue on android 12

@laurensk
Copy link

when this PR will be merged ? this fix issue on android 12

I actually wrote my own library because this seems to get no attention...

@MrElectroNick
Copy link

when this PR will be merged ? this fix issue on android 12

I actually wrote my own library because this seems to get no attention...

Can you point on repository maybe?

@laurensk
Copy link

laurensk commented May 21, 2023

when this PR will be merged ? this fix issue on android 12

I actually wrote my own library because this seems to get no attention...

Can you point on repository maybe?

It's not open source since I only implemented certain features we needed internally.

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

9 participants