读取标签从特定活动 [英] Reading a tag from a specific activity

查看:153
本文介绍了读取标签从特定活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成我的Andr​​oid应用程序,有1活动,其中它显示在NFC标签中的数据,我的问题是,每当我一敲NFC标签,应用程序打开/启动,即使它不是在后台打开或运行。我怎样才能prevent这种情况的发生?

I just finished my android app that have 1 activity, wherein it displays the data on the nfc tag, my problem is that whenever I tap nfc tag, the app opens/launch even if it is not open or running in the background. How can I prevent this from happening?

我想我的应用程序的反应时,它是开放的,谢谢

I want my app to react when it is open, thanks

推荐答案

如果您不希望您的活动在扫描标签来自动启动,只需不要注册NFC相关的意图过滤器您的应用程序的清单。

If you don't want your activity to automatically start upon scanning a tag, simply don't register NFC related intent filters in your app's manifest.

但是,如果...

  1. ...你没有注册任何NFC相关的舱单的意图过滤器,而是在NFC标签存储在Android应用程序记录(AAR)。在这种情况下,你唯一的选择就是不使用亚洲遥感协会。

  1. ... you did not register any NFC related intent filters in the manifest but instead stored an Android Application Record (AAR) on the NFC tag. In this case your only option is to not use AARs.

...你现在不能显示标签的数据在你的活动,因为你没有在扫描NFC标签接收的任何意图。在这种情况下,你应该已经注册的<一个href="http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html#foreground-dispatch"相对=nofollow> NFC前景调度系统的的>。

... you now can't display the tag's data in your activity, because you do not receive any intent upon scanning an NFC tag. In this case, you should have registered for the NFC foreground dispatch system instead of registering an NFC intent filter in your app's manifest.

这篇关于读取标签从特定活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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