Bi-Directional Android Beam

2019-02-10 15:26发布

Here's what I'm trying to do with 2 Galaxy Nexuses running Android 4.0 with NFC capabilities:

  • Device A and B are in close enough to initiate an Android Beam UI.
  • Device A sends a beam to Device B
  • Device B received beam, does some processing, and then sends a response beam back to device A

I have the initial beam from A -> B working fine but not the communication back. I do want to send something more than just an 'ACk', like a small payload of data. Is there any way to do this over NFC with the current APIs or will I have to look towards WiFi/BT p2p communication?

5条回答
女痞
2楼-- · 2019-02-10 15:37

I don't know how but it seems to work. Look at 10min 50sec in this video. They demonstrate peer to peer.

How to NFC on the Android Platform

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-02-10 15:38

I don't think this is possible unless you pull the devices apart then put them together again and explicitly beam data from Device B to A with the touch to beam UI. You can use NFC to initiate a BT connection though and get the job done.

查看更多
The star\"
4楼-- · 2019-02-10 15:40

For now, (unfortunately) peer-to-peer mode is only accessible on Android through Android Beam, which can't be used for bi-directional communication. If you want to archieve true bi-directional communication, you can better use reader/writer & card-emulation modes. When emulate a ISO/IEC 14443-4 tag, you can use APDU commands (see ISO/IEC 7816-4) to send bi-directional information.

查看更多
冷血范
5楼-- · 2019-02-10 15:45

I have not tried that myself, but you might be able to acheive a form of bi-directional communication by using one phone in reader/writer mode and the other phone in host based card emulation mode (HCE). See also this thread: NFC reader/writer mode - is it only for tags?.

查看更多
地球回转人心会变
6楼-- · 2019-02-10 15:54

while the two devices are close to each other you can show a toast at B device to ensure it receive the NDEf message

查看更多
登录 后发表回答