Monday, June 27, 2011

Re: [android-developers] Re: NFC send Url p2p

On Mon, Jun 27, 2011 at 8:43 AM, Dominik <dominik.gruntz@fhnw.ch> wrote:
> A comment to the definition of the NDEF record:
>
>>   Stringurl= "http://example.com";
>>   byte[] payload =url.getBytes();
>>   NdefRecord ndefRecord = new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI,
>> NdefRecord.RTD_URI, new byte[0], payload);
>
> this works, however I am not sure whether it completely follows the
> NDEF spec. RTD_URI is a well-known type ("U") for record type
> definitions (RTDs), but in this case I would have expected WELL_KNOWN
> as TNF, i.e.
>
>        new NdefRecord(
>                NdefRecord.TNF_WELL_KNOWN,
>                NdefRecord.RTD_URI,
>                new byte[0],
>                "http://example.com".getBytes())

FYI, that won't work. For RTD_URI, the first byte will need to be a
value that replaces your http://. See:

https://github.com/commonsguy/cw-advandroid/tree/master/NFC/URLTagger

> If TNF = TNF_ABSOLUTE_URI, i thought that this means that the type
> descriptor is a complete URI (as we know it from XML schema, for
> example). Can someone confirm this (and give an example on when to use
> TNF_ABSOLUTE_URI)?

I haven't tried TNF_ABSOLUTE_URI, sorry.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate