From e77fe607609e5a6ea59e11164e21744623cf07a5 Mon Sep 17 00:00:00 2001
From: Eric Gilmore
To obtain these extras, check to see if your activity was launched with one of @@ -513,7 +513,8 @@ contain the payload and allow you to enumerate the tag's technologies:
This section describes how to create common types of NDEF records to help you when writing to NFC tags or sending data with Android Beam. Starting with Android 4.0 (API level 14), the {@link android.nfc.NdefRecord#createUri createUri()} method is available to help you create -URI records automatically. Starting in Android 4.1 (API level 16), {@link android.nfc.NdefRecord#createExternal createExternal()} +URI records automatically. Starting in Android 4.1 (API level 16), +{@link android.nfc.NdefRecord#createExternal createExternal()} and {@link android.nfc.NdefRecord#createMime createMime()} are available to help you create MIME and external type NDEF records. Use these helper methods whenever possible to avoid mistakes when manually creating NDEF records.
@@ -528,7 +529,8 @@ record of the NDEF message that you are writing to a tag or beaming.RTD_URI
type instead
of {@link android.nfc.NdefRecord#TNF_ABSOLUTE_URI}, because it is more efficient.
-You can create a {@link android.nfc.NdefRecord#TNF_ABSOLUTE_URI} NDEF record in the following way:
+You can create a {@link android.nfc.NdefRecord#TNF_ABSOLUTE_URI} NDEF record in the following way +:
NdefRecord uriRecord = new NdefRecord( @@ -549,7 +551,8 @@ NdefRecord uriRecord = new NdefRecord(
You can create a {@link android.nfc.NdefRecord#TNF_MIME_MEDIA} NDEF record in the following ways.
+You can create a {@link android.nfc.NdefRecord#TNF_MIME_MEDIA} NDEF record in the following ways: +
Using the {@link android.nfc.NdefRecord#createMime createMime()} method:
@@ -576,7 +579,8 @@ NdefRecord mimeRecord = new NdefRecord(TNF_WELL_KNOWN with RTD_TEXT
-You can create a {@link android.nfc.NdefRecord#TNF_WELL_KNOWN} NDEF record in the following way:
+You can create a {@link android.nfc.NdefRecord#TNF_WELL_KNOWN} NDEF record in the following way: +
public NdefRecord createTextRecord(String payload, Locale locale, boolean encodeInUtf8) { byte[] langBytes = locale.getLanguage().getBytes(Charset.forName("US-ASCII")); @@ -606,7 +610,8 @@ public NdefRecord createTextRecord(String payload, Locale locale, boolean encodeTNF_WELL_KNOWN with RTD_URI
-You can create a {@link android.nfc.NdefRecord#TNF_WELL_KNOWN} NDEF record in the following ways.
+You can create a {@link android.nfc.NdefRecord#TNF_WELL_KNOWN} NDEF record in the following ways: +
Using the {@link android.nfc.NdefRecord#createUri(String)} method:
@@ -642,7 +647,8 @@ NdefRecord rtdUriRecord = new NdefRecord(TNF_EXTERNAL_TYPE
-You can create a {@link android.nfc.NdefRecord#TNF_EXTERNAL_TYPE} NDEF record in the following ways:
+You can create a {@link android.nfc.NdefRecord#TNF_EXTERNAL_TYPE} NDEF record in the following +ways:
Using the {@link android.nfc.NdefRecord#createExternal createExternal()} method:
@@ -681,19 +687,19 @@ android.nfc.NdefRecord#TNF_EXTERNAL_TYPE} have a canonical format of: declares that theurn:nfc:ext:
portion of the URN must be ommitted from the NDEF record. So all you need to provide is the domain (example.com
in the example) and type (externalType
in the example) separated by a colon. -When dispatching TNF_EXTERNAL_TYPE, Android converts theurn:nfc:ext:example.com:externalType
URN to a -vnd.android.nfc://ext/example.com:externalType
URI, which is what the intent filter in the example -declares. +When dispatching TNF_EXTERNAL_TYPE, Android converts theurn:nfc:ext:example.com:externalType +
URN to avnd.android.nfc://ext/example.com:externalType
URI, which is what the +intent filter in the example declares.Android Application Records
Introduced in Android 4.0 (API level 14), an Android Application Record (AAR) provides a stronger certainty that your application is started when an NFC tag is scanned. An AAR has the package name -of an application embedded inside an NDEF record. You can add an AAR to any NDEF record of your NDEF message, -because Android searches the entire NDEF message for AARs. If it finds an AAR, it starts the application based -on the package name inside the AAR. If the application is not present on the device, -Google Play is launched to download the application.
+of an application embedded inside an NDEF record. You can add an AAR to any NDEF record of your NDEF +message, because Android searches the entire NDEF message for AARs. If it finds an AAR, it starts +the application based on the package name inside the AAR. If the application is not present on the +device, Google Play is launched to download the application.AARs are useful if you want to prevent other applications from filtering for the same intent and potentially handling specific tags that you have deployed. AARs are only supported at the @@ -717,11 +723,11 @@ application based on the AAR.
-Note: You can override AARs and the intent dispatch system with the foreground dispatch -system, which allows a foreground activity to have priority when an NFC tag is discovered. -With this method, the activity must be in the foreground to -override AARs and the intent dispatch system.
+Note: You can override AARs and the intent dispatch system with the +
foreground + dispatch system, which allows a foreground activity to have priority when an NFC tag is + discovered. With this method, the activity must be in the foreground to override AARs and the + intent dispatch system. If you still want to filter for scanned tags that do not contain an AAR, you can declare intent filters as normal. This is useful if your application is interested in other tags @@ -799,9 +805,9 @@ API level 14 (Android 4.0) and later.
Note: If your activity enables Android Beam and is in the foreground, the standard intent dispatch system is disabled. However, if your activity also -enables foreground -dispatching, then it can still scan tags that match the intent filters set in the foreground -dispatching.
+enables +foreground dispatching, then it can still scan tags that match the intent filters set in the +foreground dispatching.To enable Android Beam:
-- cgit v1.1