googlesamples / ios-nearby

68 stars 30 forks source link

iOS cannot get distance for messages #13

Open erparker opened 8 years ago

erparker commented 8 years ago

I noticed the Android API for Nearby includes a distance property on nearby.messages, but as far as I can tell there isn't a method or propertyfor getting the distance between devices on iOS.

Is that correct? If so, is there something coming in the future that allows for distance to be determined on iOS? And for now, is there some kind of work around for getting distances while still using Nearby?

Thank you very much for your consideration, and if this isn't the appropriate place to ask this question, feel free to point to another forum if there's a better one!

dan-webb commented 8 years ago

Precise distance isn't something that's supported yet, despite the presence of the distance property on Android. It's a very hard problem, and we're working on solutions. As we find better solutions for ranging in the future, we plan to add it to the iOS API.

In the meantime, the only distance solution we offer is to use audio only (earshot on Android), which means the devices are probably within 5-10 feet of each other.

lakrme commented 7 years ago

Any news on this @dan-webb?

We're especially interested in getting the estimated distance between an iOS device and a Eddystone beacon.

dan-webb commented 7 years ago

Sorry, no progress on ranging of individual beacons. The difficulties are due to the multi-path problem of the beacon signal, and differences in antenna configurations in beacons and phones.

Would it help if we supplied the RSSI of the beacon? You can do a rough distance calculation, but it will be very noisy. Note that Apple's iBeacon API only gives you 3 range values: immediate, near, and far.

rbrki07 commented 7 years ago

I would be great if you could provide the RSSI value. Even if distance calculation is rough the RSSI value could help to find out which beacon is nearer.

dan-webb commented 7 years ago

We have discussed adding RSSI (and transmission power) to the iOS API. I've increased the priority of the feature request based on your comments here. But I can't promise a date of when it will be available.

erparker commented 7 years ago

@dan-webb Can't express my interest in this enough!

This is an ancillary question, maybe it belongs in a different thread, but if RSSI were to be added to the iOS API, would we have access to it in background modes? Getting nearby devices and distance while the app is running as well as background would solve 100% of our usecases

dan-webb commented 7 years ago

@erparker - According to this discussion, RSSI isn't supported when the scanning app is in the background: https://lists.apple.com/archives/bluetooth-dev/2012/Feb/msg00022.html

And I've confirmed this behavior. In my test app, the CBPeripheralDelegate method peripheral:didReadRSSI:error: is only called when the app is in the foreground.

maxbeech commented 5 years ago

Any update on iOS distance estimation between two devices & a device and beacon being available please?

@dan-webb

rahulvyas commented 4 years ago

Any update on iOS distance estimation between two devices & a device and beacon being available please?

@dan-webb

harshshah1992 commented 4 years ago

Hello Guyz, is anyone working to get distance between to device for iOS and Android with foreground & background mode support?