[英]How to detect/read NFC tag in service
How can I read NFC tag in background via service? 如何通过服务在后台读取NFC标签? I already can read it in activity(I've found some source codes but I don't really understand how it works) but I can't find anything about reading it in Service or Runnable.
我已经可以在活动中阅读它了(我已经找到了一些源代码,但是我不太了解它是如何工作的),但是我在Service或Runnable中找不到任何有关阅读它的信息。
Thanks for help 感谢帮助
Finally i figured out how to solve it. 最后,我想出了解决方法。 I have to use these intent filters in AndroidManifest.xml to properly run my activity.
我必须在AndroidManifest.xml中使用这些意图过滤器才能正确运行我的活动。
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.