2

I've been tasked with adding support to an app for beaming large data files (tens of megabytes) from device to device via 'NFC' on Android.

I'm aware that genuine NFC on Android is painfully slow, but I know that ICS has support for doing hand-off of the bulk data transfer to Bluetooth; and Samsung have a proprietary mechanism for doing the same via Wifi Direct (S-Beam). So that's the approach I'd want to take.

Unfortunately I cannot find any information on how to actually do this.

I've looked at the Android Beam documentation, and there's no mention of special mechanisms to support large bulk data; so I took the standard AndroidBeamDemo app and simply added a large byte array to the packet size, in the hope that it would all Just Work. It seems not to --- sending a 10kB message takes about five seconds, and trying to send a 1MB message just doesn't do anything at all (although it tells me the message was sent successfully).

For Samsung's S-Beam, I simply cannot find any documentation whatsoever.

Has anybody made this work, and if so, can they point me at an example?

David Given
  • 13,277
  • 9
  • 76
  • 123
  • 1
    youre looking for the wrong thing. Look for "how to initiate a bluetooth connection via code", and use that in your app, sending connection info via beam – K.L. Nov 08 '12 at 13:23
  • No, that's not what we want. (We already support explicit beaming by Bluetooth.) We explicitly want to beam via NFC (with hand-off to Bluetooth). The user experience is totally different. – David Given Nov 08 '12 at 14:03
  • Im afraid we didnt understand each other. The UX should be the same. The user taps phones, beaming BT connection data. Your app interceps this NFC event, and uses the received data to create a BT conenction and push the big file thru it without user intervention. From the users point of view, he just beamed his data. Whats different? This is exactly handing the fille transfer off to bluetooth you have been asking for. Are you looking for out-of-the-box mechanis, that does this? Its simple enough to implement IMHO – K.L. Nov 08 '12 at 14:20

1 Answers1

2

For Android Beam, you need to provide URIs to the files with the data using setBeamPushUris() (or setBeamPushUrisCallback() if the data is not fixed).

For S-Beam, I am not aware of any API that can be used. AFAICT, S-Beam only works with the built-in apps for pictures, video and music.

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • 2
    Agreed. Here is a sample app that beams a file via `setBeamPushUris()`: https://github.com/commonsguy/cw-omnibus/tree/master/NFC/FileBeam – CommonsWare Nov 08 '12 at 14:42
  • 1
    Thank-you --- that's precisely what I was looking for. Of course, it doesn't *work* (always producing 'Beam did not complete'), but as the only devices I have to test with are Samsung Galaxy 3s and I suspect that's Samsung's fault. Cheers. – David Given Nov 08 '12 at 15:07