This will register an Activity that will respond only to NFC tags that correspond to a URI that points a website (URL).
ACTION_NDEF_DISCOVERED(added in API level 10) is an Intent to start an activity when a tag with NDEF payload is discovered.
1. Add a new activity to your AndroidManifest.xml file. You may add it below a closing (</activity) tag.
<activity android:name=".BlogViewer">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http:"
android:host="androidsbs.blogspot.com"/>
</intent-filter>
</activity>
2. Compile and run!
Resources:Professional Android 4 Application Development by Reto Meier, pg 694
http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_NDEF_DISCOVERED
Popular Posts
- Perform an Action after Enter keypress on EditText
- Save LogCat to a Text File
- How to Get a new HttpURLConnection
- android:ems
- android:saveEnabled
- Intent setType(String type) - How to Set an Explicit MIME data type
- android:autoLink - Have a Clickable Street Address link in a TextView, in XML
- android:minHeight - Set the Minimum Height of a TextView
- requestFocus - Set Focus to a TextView, using requestFocus, in Java
- android:maxHeight - Set Maximum Height of TextView