Skip to content Skip to sidebar Skip to footer

Nfc. Start A Activity When Scanning Ndef Message

I'm trying to start a activity when my smartphone scans an NDEF message. This is my manifest: SENSITIVE. Therefore, you must always use ALL lower-case external type names in your intent filters:

<activityandroid:name="com.example.androidbeam.ReceiverNDEFActivity" ><intent-filter><actionandroid:name="android.nfc.action.NDEF_DISCOVERED" /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:scheme="vnd.android.nfc"android:host="ext"android:pathPrefix="/com.example:externaltype" /></intent-filter></activity>

Note that the NdefRecord.createExternal(...) method will automatically convert all type names to lower-case spelling.

Solution 2:

The manifest looks pretty much ok I think. Maybe you can try adding

android:exported="true"

to the activity that should receive the NFC-scanning intent.

<activityandroid:name="com.example.androidbeam.ReceiverNDEFActivity" ><intent-filter><actionandroid:name="android.nfc.action.NDEF_DISCOVERED"android:exported="true"
            /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:host="ext"android:pathPrefix="/com.example:externalType"android:scheme="vnd.android.nfc" /></intent-filter></activity>

Are you using a NFC-tag to scan from?

Post a Comment for "Nfc. Start A Activity When Scanning Ndef Message"