We are considering passing data to the Android app via NFC Forum Type 4A's NDEF.
After creating an application that reads and writes NDEF on Android, you can automatically launch the application by
I think there are two.
In any case, the OS should have analyzed the NDEF once before calling the app, but can the app use the information in the NDEF record that the OS analyzed?
Or do I have to re-communicate and re-analyze the CC and NDEF files after they are started?
Specifically, for example, there is one NDEF message in the NDEF file, and the NDEF message is
If two NDEF records are recorded, the app with the package ID specified in AAR(android.com:pkg) will automatically start, but should the app always re-communicate and re-analyze to get "Hello, world!" information?That's the question.
android android-intent
If the information was analyzed by the Android OS, I think it was included in the Intent when the application was started.
As for the reference , if it is an NDEF message, it can be retrieved from the Intent with the NfcAdapter.EXTRA_NDEF_MESSAGES
.
For NDEF messages
Parcelable[] rawMessages=
int.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
if(rawMessages!=null){
NdefMessage [ ] messages = new NdefMessage [rawMessages.length];
for(inti=0;i<rawMessages.length;i++){
messages[i] = (NdefMessage) rawMessages[i];
}
// Process the messages array.
...
}
For tags
Tag tag=intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
If the information is not included in the Intent, I think we need to communicate.
© 2024 OneMinuteCode. All rights reserved.