NfcDemo | NFC Demo for Android with Kotlin | Android library
kandi X-RAY | NfcDemo Summary
kandi X-RAY | NfcDemo Summary
Example App: NFC Demo for Android with Kotlin.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of NfcDemo
NfcDemo Key Features
NfcDemo Examples and Code Snippets
Community Discussions
Trending Discussions on NfcDemo
QUESTION
I'm trying to read a mifare card. I can read the Tag object but I can't read the NdefMessages ... When I call the intent to retrieve the ndefMessages it returns a null value instead of an array. However I can read the ID and the techlist and when I read it with another app I can see the contents so the card has data.
...ANSWER
Answered 2020-May-13 at 17:47You should be looking for NfcAdapter.ACTION_NDEF_DISCOVERED
not NfcAdapter.ActionTagDiscovered
in you onNewIntent
but as you have not correctly asked to be sent NDEF messages in your intent filter, you won't get any, you should add ndefDiscover.addDataType("*/*");
to tell it what type of NDEF messages your want before you pass the filter to EnableForegroundDispatch
Note "*/*" is to send all types, having no data type defined is to send zero data types.
Because TagDiscovered is a lower type than NDEF, even if you card has NDEF messages on it the background service won't parse them to put them in the Extras field as it is not expecting you to use them.
Docs on this are at https://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc#foreground-dispatch
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install NfcDemo
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page