I want an android app to open using nfc tag only

坚强是说给别人听的谎言 提交于 2019-12-13 04:46:02

问题


I am creating an Andriod app using nfc to check in lets say the url in the tag is "http://examples.com" I want an application to open, only when I tap on that tag.

So basically I will just edit the intent filters in my mainfest. So that everytime I tap on a tag that has the url http://developer.andriod.com/index.html the app will open

   <intent-filter>
           <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.LAUNCHER" />    
                    <data android:scheme="http"
                    android:host="developer.android.com"
                    android:pathPrefix="/index.html" />                    
    </intent-filter>

回答1:


I'm not familiar with NFC, but to my point of view you should implement the following steps. You should delete from your main activity in AndroidManifest.xml intent-filter:

<intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Thus, your application will be not seen in launcher. After that you should add an intent to be run from NFC (here I cannot help you how to do this).



来源:https://stackoverflow.com/questions/11257314/i-want-an-android-app-to-open-using-nfc-tag-only

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