• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Making NFC app as default when scanning tag

Hi,

I have coded an NFC application, but everytime i scan the tag i need to go to my application.
Currently when i scan tag, a pop up menu shows other nfc applications like one from nxp...

Is there a way ,when i scan tag my application can appear or start as default app.

thanks
kumar
 
This is entirely up to the user. when the user is presented with the list of installed apps that support the action to choose from, there should be a checkbox at the bottom of the dialog that says something like "Use as default"
 
Unfortunately my app doesn't show up in list of installed app when i scan the tag. Some of the other NFC app i downloaded show..Is there any code or permission i need to set in the manifest.
 
You need to tell the Droid that your app must be presented in the picker on certain user action like Nfc or when someone takes photo. For Nfc this would be ACTION_NDEF_DISCOVERED add to manifest file as category default. Intents from manifest are registered system wide so when that intent happens android will present picker with relevant registrations

e.g.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
</intent-filter>

will register your app to receive to receive nfc data

pay attention to mimeType, you can adjust it as you need it, for further reference:

NFC Basics | Android Developers
 
Back
Top Bottom