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
- Save LogCat to a Text File
- android:ems
- android:alpha - Set the Opacity/Transparency of Text in TextView/EditText
- android:visibility - Hide a TextView, in XML
- android:maxHeight - Set Maximum Height of TextView
- android:maxWidth - Set the Maximum Width of TextView
- android:background - Change the Background Color of an EditText
- How to Reference a Library in your Project
- android:rotationX - Rotate a TextView/EditText on the x axis
- android:ellipsize - Add an ellipsis(...) in a TextView