8

how is it possible to send data to an iPhone which acts as an iBeacon? I am looking for an process as the following:

  1. Search nearby iBeacons
  2. Connect to some iBeacon
  3. Exchange data between the devices

Does anybody know how to put the different bluetooth functions together to make this possible?

thx in advance

ErdyMurphy
  • 101
  • 1
  • 5

3 Answers3

9

Standard iBeacons are transmit-only devices that can be seen by mobile devices, but don't actually "connect" to them or exchange data.

But you can still do what you are asking if you have an app on all devices as well as a web service to do the data transfer. This would allow devices A and B to detect each other when they are nearby and exchange data. Here's how:

  1. Your app on devices A and B alternates between acting as an iBeacon (advertising its presence with an application-specific identifier and a phone-specific identifier) and ranging for iBeacon signals including the application-specific identifier.
  2. During its ranging cycle, your app on device A will detect an iBeacon transmission from device B, which includes both your application identifier and the device identifier of B.
  3. App A then makes a "write" call to the web service with a source of "A" and a destination of "B", along with any data you want to transfer, like "Device A says hello to device B."
  4. The app would also periodically make a "read" call to the web service. In this example, device B would read any information destined for B, and the web service would return a record that device A had send it a message with the data "Device A says hello to device B."

Because the same process is also running on both phones, this communication can happen both ways.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • so there is no possibility to do advertising and ranging and then switch to a bluetooth data transfer mode and back? Because it would be cooler to transfer the data with bluetooth instead of a web service... – ErdyMurphy Nov 04 '13 at 06:49
  • Sure, you can also use CoreBluetooth to transfer data directly between phones instead of a web service. Setting it up would be much more complicated because you would have to add a third and maybe fourth cycle to each app. These additional cycles would put each app into peripheral and/or central modes to send and receive Bluetooth data. But managing the timing on this with Bluetooth transfers will be very difficult with multiple devices because you cannot be broadcasting as an iBeacon as you are sending Bluetooth data. – davidgyoung Nov 04 '13 at 12:58
1

iBeacon is a proximity technology and isn't designed for data interchange. However, since the Bluetooth stack is going to be active on your iPhone acting as the beacon (so it can advertise its proximity UUID), you can use Core Bluetooth to connect to the beacon and exchange data between the devices.

neilco
  • 7,964
  • 2
  • 36
  • 41
1

Does it specifically need to use iBeacon technology? The reason I ask is that from reading your description of the process, you could achieve the same thing using iOS 7's Multipeer Connectivity. It's able to abstract out all the technical complexities of connecting 2 iOS devices together regardless of the interface, be it WiFi or Bluetooth. I've managed to build something similar using MCNearbyServiceBrowser, MCNearbyServiceAdvertiser, and MCSession classes.

Yazid
  • 970
  • 7
  • 14
  • is it possible to first detect 2 device how close to each other by using iBeacon and later based on proximity exchange data using multipeer connectivity ? – raaz Jan 23 '14 at 20:11
  • Yes you can it , There's tutorial on that in iOS 7 by Tutoials book , What's new in CoreLocation Chapter :) – rustylepord Apr 27 '14 at 09:26