0

Just to ask what is this issue that is appearing with android studio when i entered with NFC onCreate() method where the flag i input is 0 but is stated to insert pendingIntent, im not sure what does it means?

    NfcAdapter mAdapter;
    PendingIntent mPendingIntent;
    mAdapter = NfcAdapter.getDefaultAdapter(this);
    if (mAdapter == null) {
        //nfc not support your device.
        return;
    }
    mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
            getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

    }

Problem:Missing PendingIntent mutability flag

Raptor
  • 53,206
  • 45
  • 230
  • 366
Joel Tan
  • 11
  • 2
  • 1
    Does this answer your question? [Android 12 Pending Intent](https://stackoverflow.com/questions/70889493/android-12-pending-intent) – Andrew May 23 '23 at 06:38
  • 1
    For NFC the Pending Intent should be FLAG_MUTABLE . You could of course use the newer and better `enableReaderMode` NFC API to handle NFC events which does not need Intents. – Andrew May 23 '23 at 06:41

0 Answers0