You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently attempted to bring a 3 year old project that uses ti.nfc up to date by targeting android 33, updating to Titanium SDK 12.1.2.GA and ti.nfc 5.0.0, but ran into problems scanning NDEF tags that are readable with an old build of my project. Here is my e.inent for a read of a ISO 14443-3A NXP-Mifare Classic 1k tag (Tech: NfcA,MifareClassic,Ndef) tag:
Reading the tag did fire a 'newintent' event, but onNdefDiscovered, onTagDiscovered and onTechDiscovered never caught it, even though my intentFilters never changed. Catching the intents outside of foreground dispatch worked as expected.
Changing the createPendingIntent() in NfcForegroundDispatchFilter's to be FLAG_MUTABLE instead of FLAG_IMMUTABLE, with no other changes, solved my problem and I can read NDEF tags again. The e.intent now looks like:
To be honest, this is a little over my head and I'm not sure if this is the best fix. If anyone is interested, my super minor edit can be found in pull request #79
The text was updated successfully, but these errors were encountered:
That said: I don't have a real test app and different tags. But the change to MUTABLE shouldn't be hurting the module or other users. So I'll vote for including it
I recently attempted to bring a 3 year old project that uses ti.nfc up to date by targeting android 33, updating to Titanium SDK 12.1.2.GA and ti.nfc 5.0.0, but ran into problems scanning NDEF tags that are readable with an old build of my project. Here is my e.inent for a read of a ISO 14443-3A NXP-Mifare Classic 1k tag (Tech: NfcA,MifareClassic,Ndef) tag:
Reading the tag did fire a 'newintent' event, but onNdefDiscovered, onTagDiscovered and onTechDiscovered never caught it, even though my intentFilters never changed. Catching the intents outside of foreground dispatch worked as expected.
Trying multiple combinations of different Titanium SDKs and ti.nfc versions didn't seem to help, so I can't be certain what changed or when. BUT I did find a potential fix here: https://stackoverflow.com/questions/76655730/why-nfc-works-with-pendingintent-flag-mutable-and-not-with-pendingintent-flag-im
Changing the createPendingIntent() in NfcForegroundDispatchFilter's to be FLAG_MUTABLE instead of FLAG_IMMUTABLE, with no other changes, solved my problem and I can read NDEF tags again. The e.intent now looks like:
To be honest, this is a little over my head and I'm not sure if this is the best fix. If anyone is interested, my super minor edit can be found in pull request #79
The text was updated successfully, but these errors were encountered: