Is it possible to use Android Beam between an android device and another NFC device?

天涯浪子 提交于 2019-11-29 13:09:49

问题


I'd like to implement a NFC communication between my Android app and a NFC-enabled kiosk. I've read the documentation and I understand pushing data can be done in 2 ways:

  • Via foreground NDEF pushing for API level 10 to 13
  • Via Android Beam from API level 14

I think I can do what I want to via the first solution but I'd like to know if it's possible to use Android Beam between an android device and a non-android device?

Thanks for your help,

Romain


回答1:


Although the function calls between API 10 to 13 and APi 14 differ, the actual underlying protocol is nearly the same. In both cases, NFC peer-to-peer communication is done using LLCP. In API 10 to 13, the actual data transfer protocol used is NPP. In API 14, SNEP is added to that, but it will fall back to NPP when the other device does not support SNEP.

So when your non-Android device implements SNEP and/or NPP over LLCP, it can transfer data to and receive data from an Android NFC device. Several implementations of SNEP and LLCP for card reader devices exist, see for example https://github.com/grundid/nfctools.




回答2:


I looked in to this for a college project.

First please not that there are 3 modes of NFC operation { Card read/write, tag emulation and P2P communication }. Android supports Card read/write and P2P communication.

To communicate with a non Android device via P2P is quite complex as you must use the NPP (Ndef Push Protocol) built on LLCP (logical link control protocol). Your non android platform will need to implement the LLCP to be able to communicate. I'm not sure if this has been done for NFC yet. Information on the NPP/LLCP implementation can be found here

The next approach is to use card read/write mode to communicate with the non Android device running in card emulation mode. This way you can send APDU's to the emulated tag to send and receive data. I did this approach in reverse using BlackBerry for my project. BlackBerry supports card emulation so I used the non Android device (ACR122U) to send APDU's to the BlackBerry.

While the first approach (P2P) is obviously the ideal way to go, the second one could be easier to implement. It worked quite well for me in my application anyway, I created a system that accepts payments via NFC.

Please note that the ACR122U doesn't have good support for NFC Tag Emulation so it is not suitable for you. The LibNFC website is a great start to find a device that supports tag emulation.

I am now finished the project and it works great using the ACR122U device. If you need any help on the second approach please ask.




回答3:


See belows Issue 28014: Enable real NFC p2p communication and the option to disable the "Touch to Beam" UI
https://code.google.com/p/android/issues/detail?id=28014 Android Peer to Peer dose not work at all.



来源:https://stackoverflow.com/questions/10813483/is-it-possible-to-use-android-beam-between-an-android-device-and-another-nfc-dev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!