As you have created a new
and empty Intent
there is nothing to read from it. So as expected.
An Intent
are really just a generic storage class used generally to pass data in a standard format between one Activity and another.
They use keys
to pass specific data between Activities. One of the keys
used by the the System NFC Activity to pass NFC related data to your Activity is the NfcAdapter.EXTRA_TAG
key.
The Intent has nothing to do with actually reading an NFC Tag, they are just used as a communication method to ask the System NFC Activity to do stuff and how it can returns the data.
So you can create them anywhere you want, with lots of different content and pass them to any Activity to give it data or receive them to be sent data.
You seem to have a miss understanding how NFC works in Android.
The basic concept is.
Old API's
You create an Intent
with basically a "message" to the System NFC App say "I would like to be sent data about specific types of NFC data when one comes in to range", you send that Intent
message to the System NFC Activity using enableForegroundDispatch
, when the System NFC App sees a Tag of the right type come in to range it creates an Intent
to store the data about the NFC tag to send back to the activity that asked for it.
This is using a generic method for inter process communication.
Newer API's
Do something similar when you enableReaderMode
you use an NFC specific method to send data again about about what Tags you are interested in and it sends back the in a more specific format when it sees a Tag of the requested type come in to range.
Example of newer API's https://stackoverflow.com/a/64921434/2373819
Manifest Filter
The Manifest Filter are independent of the Old and New API's, they are about storing information that the System NFC App can use to decide if it should start your App when it sees a particular type of NFC Card. They can be used with both Old and New API's but they pass an Ìntent
message using the same fields as the Old API to your App, this can be read and processed from onCreate
using getIntent
.
So creating a new
and empty Intent
and expecting to magically get some NFC data is wrong.