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

Ionic capacitor targetsdk 33 app crash with plugin is installed without nfc plugin work works ok #490

Open
adeel399 opened this issue Jul 30, 2023 · 28 comments

Comments

@adeel399
Copy link

No description provided.

@EYALIN
Copy link

EYALIN commented Aug 3, 2023

@adeel399 you can use my Cordova plugin which forked from here and maintained
https://github.com/EYALIN/community-cordova-plugin-nfc

@adeel399
Copy link
Author

adeel399 commented Aug 3, 2023

@adeel399 you can use my Cordova plugin which forked from here and maintained
https://github.com/EYALIN/community-cordova-plugin-nfc

So there crashing issue on andoid 12 or above is resolved in that and also the issue plugin not working if we resolve crashing issue

@adeel399
Copy link
Author

adeel399 commented Aug 3, 2023

I am using capacitor so how i can use that

@adeel399
Copy link
Author

adeel399 commented Aug 3, 2023

let flags = this.nfc.FLAG_READER_NFC_A | this.nfc.FLAG_READER_NFC_V;
this.readerMode$ = this.nfc.readerMode(flags).subscribe(
tag => {
this.tgval=JSON.stringify(tag);
alert(JSON.stringify(tag))
},
err => {
alert('Error reading tag'+err)
}
)

here is my code to read nfc but on android 13 it does nothing even without your plugin that u suggest to use above..
plz help what i am doing wrong here.
i does not even give error alert

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@adeel399 in capacitor you can use cordova plugins
https://capacitorjs.com/docs/v2/cordova/using-cordova-plugins

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

@adeel399 in capacitor you can use cordova plugins
https://capacitorjs.com/docs/v2/cordova/using-cordova-plugins

It worked but not for android 13

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@adeel399 you mean that from Android 13 you cannot add Cordova plugins? or the plugin is not working from Android 13?
if so, my forked plugin will solve all your issues
https://github.com/EYALIN/community-cordova-plugin-nfc

remove the NFC plugin and add this:

npm install community-cordova-plugin-nfc
npx cap sync

it is a maintained plugin

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

@adeel399 you mean that from Android 13 you cannot add Cordova plugins? or the plugin is not working from Android 13?
if so, my forked plugin will solve all your issues
https://github.com/EYALIN/community-cordova-plugin-nfc

remove the NFC plugin and add this:

npm install community-cordova-plugin-nfc
npx cap sync

it is a maintained plugin

I used that npx sync etc before it was not working on android 12 either but now its worked but on android 13 still issue i ll send u error

@sonikdesign
Copy link

sonikdesign commented Aug 4, 2023

I'm here for the same reason, I'm testing on Android 12. App closes.
Working with Cordova-Android@12

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

It gives alert of nfc avilable but on clicking read button nothing shows i have also added alert on error

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@sonikdesign @adeel399 did you try the plugin community-cordova-plugin-nfc ?

@sonikdesign
Copy link

@sonikdesign @adeel399 did you try the plugin community-cordova-plugin-nfc ?

Hi Eyalin I'm tring right now

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

@sonikdesign @adeel399 did you try the plugin community-cordova-plugin-nfc ?

Yes i did i can send u apk if u have android 13 u can check it

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@adeel399 great. what is the error in logcat?

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

@adeel399 great. what is the error in logcat?

Nothing shows

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

the app cannot crash without anything in the logcat

@sonikdesign
Copy link

sonikdesign commented Aug 4, 2023

@EYALIN your plugin works great on a device with Android 12 (OPPO A16s). I'm converting an app for Android from Cordova-Android 8.1.0 to 12.0.0. Target Android 13 (API level 33) is around the corner. Phonegap-nfc crashes the app with this new Cordova setup. Now I can read again nfc tags. In the next few hours I hope to test iOS too.

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@sonikdesign sound great. follow my plugin so you will be notified on any change.

@adeel399 i think that maybe you didn't install it correctly ?

@adeel399
Copy link
Author

adeel399 commented Aug 4, 2023

@sonikdesign sound great. follow my plugin so you will be notified on any change.

@adeel399 i think that maybe you didn't install it correctly ?

I did install it correctly and for my client its working bcoz he has android 12 but same app on my phone which is android 13 showing nothing ,

@EYALIN
Copy link

EYALIN commented Aug 4, 2023

@adeel399 if an app is crashing you must have exception in logcat, please try to track it

@quiots
Copy link

quiots commented Aug 21, 2023

Hi @EYALIN, I also have this problem with my Android 13 app with IONIC v6. The application crashes during the NFC scan. I installed your forked community-cordova-plugin-nfc plugin, but I still have the same problem; a SecurityException is thrown. Here's what I see in the logcat:

FATAL EXCEPTION: pool-3-thread-1 Process: com.abc.app, PID: 31842 java.lang.SecurityException: Permission Denial: Tag ( ID: 04 50 A6 3A 2C 5E 81 ) is out of date at android.nfc.Tag.getTagService(Tag.java:388) at android.nfc.tech.Ndef.canMakeReadOnly(Ndef.java:344) at com.chariotsolutions.nfc.plugin.Util.ndefToJSON(Util.java:41) at com.chariotsolutions.nfc.plugin.NfcPlugin.buildNdefJSON(NfcPlugin.java:766) at com.chariotsolutions.nfc.plugin.NfcPlugin.fireNdefEvent(NfcPlugin.java:752) at com.chariotsolutions.nfc.plugin.NfcPlugin.lambda$parseMessage$10(NfcPlugin.java:721) at com.chariotsolutions.nfc.plugin.NfcPlugin.$r8$lambda$Ex2eFqINoQ5KTuUzc8Ttwu00_-8(Unknown Source:0) at com.chariotsolutions.nfc.plugin.NfcPlugin$$ExternalSyntheticLambda0.run(Unknown Source:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

Does this remind you of anything by any chance? Thanks in advance

PS : @adeel399 did you finally find a solution for your issue ?

@adeel399
Copy link
Author

Yeah on android side mine is resolve ios stil having issue which @EYALIN working i think on

@quiots
Copy link

quiots commented Aug 21, 2023

Great news

So no more crash on Android 13 for you ? you just installed community-cordova-plugin-nfc? nothing more?

Were you able to see in your logcat if the same exception was raised?

Thank you for your responsiveness @adeel399 !

@adeel399
Copy link
Author

Yup , i never see that exception

@EYALIN
Copy link

EYALIN commented Aug 31, 2023

@adeel399 sorry for the delay, i was out of work for a while.
since the issue you have is with capacitor, it is more challenging for me to test it, since im using Cordova.

@minorityuk
Copy link

@EYALIN @adeel399 I am using the older version of PhoneGap with capacitor and just wondering how to install your version I have tried npm install community-cordova-plugin-nfc which installed the package but I can't seem to get access to NFC as it says modules dont exist.

Any steps that I can follow to see if this resolves the issue?

My issue is on Android ISO15693 pops out the tag id in reverse to a nfc pen I have and Apple products. I want to see if this resolves the issue?

@Dev-it-a-dev
Copy link

+1 having the same issue

@NityaSantosh26
Copy link

Hi @quiots , Did you find any solution for the issue or the exception that is thrown. That is resulting in app crash when the app is launched using nfc chip.

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

7 participants