johnnyb / ntag424-java

A Java library for the NXP NTAG 424 DNA chip
MIT License
21 stars 3 forks source link

demo app #8

Open amicwall opened 7 months ago

amicwall commented 7 months ago

hey @johnnyb I installed the Android project and it compiles after adding the IMMUTABLE flag here: PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, launchIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);

However, when I approach my NFC card, it never detects the tag: onNewIntent intent=Intent { flg=0x30000000 cmp=com.bplearning.ntag424demo/.MainActivity } com.bplearning.ntag424demo D handleIncomingIntent action=null

what am I missing ?

When using the NFC tools Android app, it detects: Tag type: ISO 14443-4, NXP Mifare DESFire Data Format: NFC Forum Type 4

ChristianGreiner commented 6 months ago

@amicwall

I fixed this issue by set the flags to:

PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE

// Full code:
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, launchIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE );
johnnyb commented 6 months ago

Did you change the API version on this? For Min API 28, FLAG_MUTABLE isn't available.