First pass at advanced NFC tag dispatching APIs and other cleanup.
Jeff Hamilton [Fri, 3 Dec 2010 23:34:31 +0000 (17:34 -0600)]
Change-Id: I288a13cea9967c2f852200e8bd1a802b7d96655d

AndroidManifest.xml
src/com/android/apps/tag/TagViewer.java

index 8410b20..0af8309 100644 (file)
             android:theme="@android:style/Theme.NoTitleBar"
             android:launchMode="singleTop"
         >
+            <!-- Catch the generic intent so we can display something for unknown tags -->
             <intent-filter>
                 <action android:name="android.nfc.action.TAG_DISCOVERED"/>
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
 
+            <!-- Offer to display anything with NDEF data -->
+            <intent-filter>
+                <action android:name="android.nfc.action.TECH_DISCOVERED"/>
+                <data android:scheme="vnd.android.nfc" android:host="tag" android:pathPattern=".*\/6\/.*" />
+                <category android:name="android.intent.category.DEFAULT"/>
+            </intent-filter>
+
             <intent-filter>
                 <action android:name="android.intent.action.VIEW"/>
                 <data android:mimeType="vnd.android.cursor.item/ndef_msg"/>
index 97356b8..99efc3b 100644 (file)
@@ -155,7 +155,8 @@ public class TagViewer extends Activity implements OnClickListener {
     void resolveIntent(Intent intent) {
         // Parse the intent
         String action = intent.getAction();
-        if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
+        if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
+                || NfcAdapter.ACTION_TECHNOLOGY_DISCOVERED.equals(action)) {
             if (SHOW_OVER_LOCK_SCREEN) {
                 // A tag was just scanned so poke the user activity wake lock to keep
                 // the screen on a bit longer in the event that the activity has