Android NFC读取数据
1、添加相应的权限和gradle引用
<uses-feature
android:name=”android.hardware.nfc”
android:required=”true”/>
<uses-permission android:name=”android.permission.NFC”/>
api ‘com.google.guava:guava:25.1-android‘
2、在res下创建xml文件夹,然后新建xml文件nfc_tech_filter
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <tech-list> <resources > <tech-list> <!--<tech>android.nfc.tech.IsoDep</tech>--> <tech>android.nfc.tech.NfcA</tech> <!--<tech>android.nfc.tech.NfcB</tech>--> <!--<tech>android.nfc.tech.NfcF</tech>--> <!--<tech>android.nfc.tech.NfcV</tech>--> <tech>android.nfc.tech.Ndef</tech> <!--<tech>android.nfc.tech.NdefFormatable</tech>--> <!--<tech>android.nfc.tech.MifareClassic</tech>--> <!--<tech>android.nfc.tech.MifareUltralight</tech>--> </tech-list> </resources> </tech-list> </resources>