我想要一个Android应用程序,打开只使用NFC标签 [英] I want an android app to open using nfc tag only

查看:152
本文介绍了我想要一个Android应用程序,打开只使用NFC标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用NFC来检查创建的Andr​​iod应用程序
可以说,在代码中的网址是http://examples.com
我想要一个应用程序打开,只有当我在该标签挖掘。

所以基本上我只会在我mainfest编辑意图过滤器。这样每次我敲击具有URL的标记 http://developer.andriod.com/index.html 应用程序会打开

 <意向滤光器>
           <作用机器人:名字=android.nfc.action.NDEF_DISCOVERED/>
                <类机器人:名字=android.intent.category.LAUNCHER/>
                    <数据机器人:计划=HTTP
                    机器人:主机=developer.android.com
                    机器人:路径preFIX =/ index.html的/>
    &所述; /意图滤光器>


解决方案

我不熟悉NFC,但我的观点,你应该执行以下步骤。你应该从你的主要活动中删除在AndroidManifest.xml意图过滤器:

 <意向滤光器>
     <作用机器人:名字=android.intent.action.MAIN/>
     <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>

因此​​,您的应用程序将不会出现在发射器。之后,你应该添加要从NFC运行意图(在这里我不能帮你如何做到这一点)。

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>

解决方案

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).

这篇关于我想要一个Android应用程序,打开只使用NFC标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆