mardi 30 décembre 2014

Launch Specific App when NFC is discovered


Vote count:

0




I am using NFC in my app and it is working fine. However I want to make sure that only my app is launched and no other App is there to handle the intent. Following is the code for it in my Manifest file:



<activity android:name="com.mypackage.name.BeamActivity">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>


I have another sample app on my phone which is detecting NFC Intent and providing me Intent Chooser. Following is the code for it in Manifest file.



<activity android:name="com.package2.name.NFCStickyNotesActivity" android:label="Sticky Notes" >
<!-- Handle notes detected from outside our application -->
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>


I would like my App to be the only app to handle the particular NFC Intent when my App push it across from another device.


I am not sure whether I have to do something specific in the manifest file or in the code. Any help is appreciated.



asked 3 mins ago







Launch Specific App when NFC is discovered

Aucun commentaire:

Enregistrer un commentaire