[android-developers] Re: NdefRecord(NdefMessage) extraction from the intent in a NFC design

2011-08-30 Thread Dominik
 Though, some of the extras, especially
 EXTRA_NDEF_MESSAGES, might be null.
All the extras provided by an intent behave as a map, i.e. if the
extra is not defined, then null is returned, so you can also ask for
the extra
   intent.getStringExtra(android.nfc.extra.SOMETHING)
and you will get null as result (as this entry is not available);
exceptions are never thrown.

So if you say that EXTRA_NDEF_MESSAGES might be null, this means that
this extra is not available. According to the documentation, only
getParcelableExtra(NfcAdapter.EXTRA_TAG) is guaranteed to be non-null.
Dominik

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: NdefRecord(NdefMessage) extraction from the intent in a NFC design

2011-08-25 Thread Michael Roland
Hallo Dominik,

 What do you mean by all three NFC intents *have* three extras? I
 ask, because the documentation at
 http://developer.android.com/reference/android/nfc/NfcAdapter.html
 states, that EXTRA_ID and EXTRA_NDEF_MESSAGES are optional (which is
 obvious for the latter) and only EXTRA_TAG is mandatory.

Correct. Those intent extras are listed as optional. Still the current
implementation (or at least the one in Android 2.3.4) adds all three
extras to every intent. Though, some of the extras, especially
EXTRA_NDEF_MESSAGES, might be null.

 Anyway, in which case is the ID field not available?

I don't think that there is any case where the ID field will be
empty/not available. For NFC/RFID tags there will always be an ID field.
Even for the NDEF push protocol a mock tag with an ID of
new byte[] { 0x00 }
is used.

br,
Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: NdefRecord(NdefMessage) extraction from the intent in a NFC design

2011-08-18 Thread Dominik
What do you mean by all three NFC intents *have* three extras? I
ask, because the documentation at
http://developer.android.com/reference/android/nfc/NfcAdapter.html
states, that EXTRA_ID and EXTRA_NDEF_MESSAGES are optional (which is
obvious for the latter) and only EXTRA_TAG is mandatory.

Anyway, in which case is the ID field not available?

Dominik

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: NdefRecord(NdefMessage) extraction from the intent in a NFC design

2011-08-16 Thread Michael Roland
Hallo,

first of all, the prefered method of receiving tag detection events is
the android.nfc.action.TECH_DISCOVERED intent, the intent
android.nfc.action.TAG_DISCOVERED is only used for fall-back tag
detection.

All three NFC intents (NDEF_DISCOVERED, TECH_DISCOVERED,
TAG_DISCOVERED) have three extras:

android.nfc.extra.ID: This is the UID (or whatever it's equivalent
is called for that technology).

android.nfc.extra.NDEF_MESSAGES: If the tag is an NDEF tag (or a
dummy tag for NPP) this extra contains the received NDEF messages.

android.nfc.extra.TAG: This is the Tag object for the detected tag.
You can use it to get the tags technology and to create technology
specific connections.

br,
Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en