Start an Android app/intent from an NFC tag?

徘徊边缘 提交于 2019-12-17 18:37:20

问题


On an Android device equipped with NFC reader hardware, is there any in-built support to use the NFC tag contents to fire off an intent (e.g. starting an app)? I am asking whether the support is there by default, I know I could build my own app to listen for NFC events and handle them.

All the NFC tag writing apps I've seen appear to only support text/URLs/contacts, and the contacts support seems useless as many are far too big to fit in a tag.


回答1:


According the the Android Developer site, it is possible for your app to filter NFC intents such as ACTION_NDEF_DISCOVERED.




回答2:


This is possible with Android Application Records. You basically write the package name of the app that you want to start into your NFC tag and when a device scans it, it will do its best to open the application. If its not there, it will take you to Market to download it. This is only available to 4.0 devices and up.

See this dev guide: https://developer.android.com/guide/topics/connectivity/nfc/nfc.html#aar




回答3:


If you are not trying to program your app to do this yourself then you can use a 3rd party app. Such as "Trigger" (I believe it used be called NFCTasker or something like that).

You can use that to read from tags and write to tags. You can create various actions including launch an app (others include changing volume, toggling wifi, text to speech, sending messages, etc).



来源:https://stackoverflow.com/questions/8615240/start-an-android-app-intent-from-an-nfc-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!