0

I found many weak points of Android NFC:

 ndef.connect() 

cannot work for NFC phone itself, only for tag. It's no way to check the connection status when other phone close to the back.

NDEF cannot interactively send/receive in two way. On the device, tap the screen to raise a message send, and then disconnected, no way to get back data immediately.

NFC api does NOT support card mode. This is so weakness point. There's so many situations need the Phone act as RFID card. Among of them, sometimes no need security element. Once the UID available, server-end can do authentication and rest of things.

I am asking for how to check the connection status after NDEF message has been sent or received complete ?

NFC guy
  • 10,151
  • 3
  • 27
  • 58
fordiy
  • 264
  • 5
  • 10

1 Answers1

0

You can register your app's activity to receive a callback when NDEF push via Android Beam is completed using NfcAdapter.setOnNdefPushCompleteCallback().

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • This doesn't means it can response back to the sender immediately. And also setOnNdefPushCompleteCallback() is run on bound thread. It cannot do much things inside its call back function, e.g. AsyncTask is NOT support inside the setOnNdefPushCompleteCallback(). – fordiy Aug 05 '12 at 04:55
  • Yes, that is correct. The NDEF exchange is asynchronous and you cannot send messages in both directions simultaneously. Besides that, you probably should not want to do a lot of things in the callback itself. Just create a separate thread yourself and post a message to it from the callback to make it perform whatever many things you want to do when an NDEF message has been sent successfully. – NFC guy Aug 06 '12 at 19:51
  • I just want to simply response back data to the initiator. How to do it? – fordiy Aug 12 '12 at 15:00
  • It's simply not possible... :( Unless if one of the 2 devices is not an Android device and that device is sending the data. Then you might try a trick like resetting the RF field, which results in the Android device discovering the other device again. This would enable the Android device to send an acknowledgement of the received data. – NFC guy Aug 12 '12 at 18:00