ndef

Method NdefRecord.createTextRecord(“en” , “string”) not working below API level 21

故事扮演 提交于 2019-11-26 18:36:00
问题 This code works fine when I use it on a device with Android Lollipop (5.x) or Marshmallow (6.0): @TargetApi(Build.VERSION_CODES.LOLLIPOP) public NdefMessage createNdfMessage(String content) { NdefRecord record = NdefRecord.createTextRecord("en", content); NdefMessage msg = new NdefMessage(new NdefRecord[]{record}); return msg; } But when I try this on a device with Android 4.2.2 (API level 17) my app crashes. How can I use this code to create a Text record on API levels below 21 (that's the

Get NFC tag with NDEF Android Application Record (AAR)

♀尐吖头ヾ 提交于 2019-11-26 08:35:26
问题 I am working on an NFC-application. To start my app, I am using a NDEF-tag with an AAR NDEF Record inside. This works fine. But now I want to read the tag content with the app directly. How can I do this? (It already works, when I remove the tag from the phone and touch it again, but I want to eliminate this step.) Manifest: <?xml version=\"1.0\" encoding=\"utf-8\"?> <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"nfctagscanner.mobileapps.lt.nfctagscanner\" >