-
Notifications
You must be signed in to change notification settings - Fork 578
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 - Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent #465
Comments
I can confirm this issue, the plugin is not usable on Android 12. Please fix! |
Can confirm the same issue. Disabling plugin for now but will check into work arounds. |
I fixed it by editing "NfcPlugin.java" under the Android file to have this code: ` if (pendingIntent == null) {
|
I also made a fork here: |
ok, but on line 486 of NfcPlugin.java there's an error: |
i fixed this on my fork: https://github.com/dilo99/phonegap-nfc |
OK thanks. Let me know if helpful I can change mine otherwise probably best to do a PR for yours |
@escully27 > OK thanks. Let me know if helpful I can change mine otherwise probably best to do a PR for yours ok i created a PR, I don't know how useful it is, there are another 15 waiting for more than two years ... |
How does this work for you guys? I've tried adding the fix but it won't work. |
You have to update the repo you’re using and reinstall it, changing the
Java code will be overwritten whenever it’s built and run again.
…On Wed, Aug 10, 2022 at 7:59 AM René Dyhr ***@***.***> wrote:
How does this work for you guys? I've tried adding the fix but it won't
work.
The Java code does register, but the action returns null and therefor
never sends it back to Cordova.
—
Reply to this email directly, view it on GitHub
<#465 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUZFS4BNDPCJERB7LZVEDLVYORUBANCNFSM5PDP4R2Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
That I'm aware of and have of course made sure it's not being overwritten again. |
Can you post the full code surrounding the .getAction line that's returning null? |
Of course!
And then the parseMessage function until it stops.
Before the |
Addition to my last reply, I have the logs from NfcPlugin while it works and when it's broken. This is when it works.
And after the fix:
Could it be because I'm using [email protected]? (UPDATE: Have tried both @10.0.0 and @11.0.0) |
I do think I found my issue. Though since our app is backwards compatible with older Android versions, we had to hardcode the value for the flag, since FLAG_MUTABLE isn't available in our stack. |
For all Capacitor developers: Capawesome has recently announced an up-to-date Capacitor NFC plugin. Maybe worth a try. My client unfortunately still hangs on Cordova. |
I have the same problem after upgrade my solution to Android 32 but i works good before (Android 30) Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent Is it possible to resolve by my own? Other solution will be return to previous version but Google Play doesnt allow 30 anymore. I have tried to change the line 486 by my self and seems to work fine but i am not sure if it will works for all devices: \android\capacitor-cordova-android-plugins\src\main\java\com\chariotsolutions\nfc\plugin\NfcPlugin.java |
@Nickholas If you are still having issues with API 32, please refer to my comment on a similar issue. I hope it works for you. |
I solved changing the line 486 of the folder called NfcPlugin.java that you can find in the ·..android\capacitor-cordova-android-plugins\src\main\java\com\chariotsolutions\nfc\plugin" directory.
|
hi, any update for a solution ? |
Ist this plugin still under maintenance as there hasn't been any activity for nearly 2 years? Do you recommend any other NFC plugin? Related issue: ionic-team/capacitor#5392 |
@escully27 and @ath0mas thx for your forks. Does your build work? |
@pilz97 do you have the build tools for Android API 30/31 installed? When I made my code change, I didn't have to include any additional import references than what were already in the solution. |
@pilz97 Indeed in my fork I went a bit too quick on removing the check on
|
@Paradox7208 @ath0mas thx for your answers i still was on cordova-android 9.x now i upgraded to 11.0.0 and it works. |
The plugin works perfectly in all devices except for Andorid 12.
I get following error
I see the problem is in
createPendingIntent
MethodWould like to know if I am doing something wrong? or is this needs to be fixed
P.S I use this plugin for only reading NFC tags
The text was updated successfully, but these errors were encountered: