4

The Android NDEF Push Protocol Specification from Feb 2011 says: This allows for bi-directional NDEF exchange between NPP devices.

Today is 2015, and I want a simple message exchange between two devices:

 Device 1         Device 2

"Hello"    ---> 
           <--- "Welcome"
"Goodbye"  ---> 
           <--- "Farewell"

In other words, I want the recipient to send an acknowledge message.

How do I send information in both directions and make the two devices negotiate via NFC?

A similar question from 2011: Bi-Directional Android Beam

Community
  • 1
  • 1
18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
  • It is not possible. NFC is half-duplex. 1 device acts as active which produces active RF and other as passive. In 1 touch or tap, you can only send 1 message say "Hello". –  Nov 13 '15 at 12:52
  • 2
    @VivekKN this isn't true. Bi-directional communication IS possible. Android beam is limited to one callback message. Put 1 device in reader/writer and the other in card-emulation to archieve bi-directional communication. – S.Pols Nov 13 '15 at 15:00
  • @S.Pols Yeah thats what i am saying. Read/write mode is nothing but passive mode while card emulation mode is active mode(where you produce RF). So active device sends Hello and the passive device receives it and displays Welcome but cannot send Welcome to active device. –  Nov 13 '15 at 15:03
  • Possible duplicate of [Is it possible to with one touch two android devices exchange data via NFC?](http://stackoverflow.com/questions/23815555/is-it-possible-to-with-one-touch-two-android-devices-exchange-data-via-nfc) – Michael Roland Nov 15 '15 at 10:56
  • @VivekKN also NFC is not bidirectional the LLCP protocol of which peer-to-peer is based takes care of that by polling the passive device. So in practice communication it is in fact bidirectional. However, Android does not expose the full LLCP to applications, so you're left with NPP and SNEP. And these protocols dumb down the fine LLCP to unidirectional transport again. – Nils Pipenbrinck Nov 15 '15 at 19:56

2 Answers2

0

The words to google for are APDU and card emulation.

Working code may be found here: https://github.com/grundid/host-card-emulation-sample

and the corresponding blog article is here: http://blog.opendatalab.de/hack/2013/11/07/android-host-card-emulation-with-acr122/

It works for 2 phones: start the app via Eclipse on both phones, dismiss the activity on one (only one!) of them, and then hold the two phones back to back.

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127