简体   繁体   中英

How to detect/read NFC tag in service

How can I read NFC tag in background via service? 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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM