Skip to content Skip to sidebar Skip to footer

Reading Nfc Tags Only From A Particuar Activity

Ill first tell you what I am doing. I have three activities in the sequence, Activity1>>Activity2>>Activity3. Now I want to read NFC tags only from the Activity2 when I

Solution 1:

As a foreground application, your app will always have the chance to react first on the touched tag. So what you need to do is to enable forgraoundDsipatch for your activities, and on Activity1 and Activity3 just to ignore the event, and on Activity2 process the information of the touched tag. Otherwise if your app do not take the event of the detected tag, the android dispatch system will continue to search suitable application to trigger and when it find it it will start it on top of your app.

For more information on Foreground Dispatch look here: http://developer.android.com/guide/topics/nfc/advanced-nfc.html#foreground-dispatch

Solution 2:

Only set an intent-filter for whichever NFC intent you are interested in on Activity2. See the Android NFC Demo AndroidManifest.xml for an example.

Post a Comment for "Reading Nfc Tags Only From A Particuar Activity"