How to send some data between iBeacons

2019-04-15 20:42发布

I started to develop with iBeacon technology. I know how connect, calculate proximity ect ect.... But one time that the connection is established, how I can send some text data between sender and receiver? There is a method (for example) can I use in some way the

self.peripheralManager.accessibilityLabel

Is enought also the deviceID that I can manage it with a WebServer Thank you....

标签: ios7 ibeacon
3条回答
劫难
2楼-- · 2019-04-15 21:12

The iBeacon protocol is only for transmitting / discovering beacon IDs and calculating their proximity. That is all that it does.

Anything additional to that would have to be done separately - presumably using CoreBluetooth, or iOS's new Multipeer Connectivity functionality. In fact, discovering nearby users and transmitting data between them is precisely what Multipeer Connectivity is intended for.

查看更多
甜甜的少女心
3楼-- · 2019-04-15 21:17

iBeacons are only really used as transmitter so you can't really send data to them.

More info on the problem/solution can be found here: Transmitting data using iBeacon or similar technology

查看更多
Luminary・发光体
4楼-- · 2019-04-15 21:20

You might try using Bluetooth LE (CoreBluetooth) instead of iBeacon if your main goal is to send data back and forth between the two devices.

You can see how this is done in this sample project: SimpleShare: Easy Proximity-based Bluetooth LE Sharing for iOS

The technique is to advertise your app's "Service" over Bluetooth LE, then when another device discovers your phone and connects, your phone starts updating the value of the "Characteristic" to send longer text strings in small chunks that fit the Bluetooth LE data size limits. SimpleShare uses this technique to send an array of strings from one phone to the other, which could be used for sending yes/no between the phones, but also for sending IDs of objects or users between the phones, that can then be used to download more details about that userID from a web service.

CoreBluetooth also has the advantage over iBeacon that it can keep running when the app is in background mode, so if knowing specifics about each phone's distance is less important to you than sharing text between the phones, it might be the better framework to use for your app.

Hope that helps!

查看更多
登录 后发表回答