nfc - Android Application Record compatibility with pre-ICS -



nfc - Android Application Record compatibility with pre-ICS -

there's new method in ndefrecord allows writing androidapplicationrecord ndefmessage. not necessary in pre ice-cream-sandwich, since if want handle specific uri nfc tag in application (like defined in intent-filter) not delivered application, unless define record.

createapplicationrecord(string packagename);

this not available kind of compatibility bundle (i didn't find one), implementaion simple.

first add together ndefrecord want readable nfc device (remember uri can formatted/shortened uri_prefix_map)

ndefrecord[] nr = new ndefrecord[2]; nr[0] = new ndefrecord(ndefrecord.tnf_well_known, ndefrecord.rtd_uri, new byte[0], uribytes);

add aar in next place

static final byte[] rtd_android_app = "android.com:pkg".getbytes(); if (android.os.build.version.sdk_int >= android.os.build.version_codes.ice_cream_sandwich) nr[1] = ndefrecord.createapplicationrecord("your.package.name"); else nr[1] = new ndefrecord(ndefrecord.tnf_external_type, rtd_android_app, new byte[] {}, "your.package.name".getbytes());

you not need aar handle specific uri. aar method guarantee app started instead of app can handle same uri.

android nfc android-4.0 ndef android-applicationrecord

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -