Search code examples
androidnfcnfc-p2p

Android NFC : SNEP protocol and P2P response


I am trying to implement a P2P communication between two Android phones (one of them will be replaced by an independent device in the end). I have seen that Android 4 supports SNEP which is published by the NFC forum and should be available on non-android devices.

I have following the Google tutorial for NFC P2P (http://developer.android.com/guide/topics/nfc/nfc.html#p2p) and I can send some information from one phone to the other, but I have a few questions:

  1. Android Beam is just a name for NFC or it is an Android protocol working over SNEP/NPP ? If it's a protocol, how to do NFC P2P without Beam ?
  2. How to set the use of SNEP ?
  3. How to send a response to the other device when the connection is initialized (first message received) ?

Thank you for your help !!!


Solution

  • Android Beam is just a name, correct. Devices use SNEP by default, if that fails, it tries NPP. You can't send a response really from the receiving device to the sender. You can only use a callback to be notified of a successful push:

    http://developer.android.com/reference/android/nfc/NfcAdapter.OnNdefPushCompleteCallback.html