I'm trying to "connect" two devices using iBeacon , making one of them the "Server" (listener) and the other the "client" (performing discovery or ranging).
"advertister" - iPad Mini 2 Running iOS 7.1.2
"client" - iPhone 6 Plus running iOS 8.0.2
I have the advertiser running this code
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString: @"B9407F30-F5F8-466E-AFF9-25556B57FE6D"];
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
ESTBeaconRegion *region = [[ESTBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"myapp"];
And then have the "client" run this code to discover
[self.beaconManager startEstimoteBeaconsDiscoveryForRegion: region];
But I always get 0 beacons inside the delegate.
When I try "startRangingBeaconsInRegion" I sometimes get "1" but only when "entering" the region and not always. I'd rather to be able to "scan" for nearby devices that use my app. Can this be done ?
Also, I want to "Transmit" a message between those devices whenever I discover one. Is there any other way except for local push notification ? Any way to actually "transmit" this message over bluetooth ?
Sorry for the long question, and hope this is possible :)
Hi there -- to start advertising as an iBeacon, check out the "startAdvertisingWithProximityUUID:major:minor:identifier" method of the ESTBeaconManager:
Let me know if you have any questions.
Thanks for the answer...
I actually did use that method (forgot to write it down). I'm using the uuid at the top and then 1 for major and 2 for minor.
But -(void)beaconManager:(ESTBeaconManager *)manager
never gives anything (just returns an empty array) ...
Not sure what I'm missing.
Also wondered if it would be possible to search for those devices while in the background? or - will it keep advertising itself even when the app is in the background ?
Thanks for clarifying. "startAdvertisingWith..." virtual beacon will only be discovered by "startRangingBeaconsInRegion" and "startMonitoringForRegion".
"startEstimoteBeaconsDiscovery" works only with physical Estimote beacons.
So there is no way to actively scan for any virtual beacons around me ? Except for the "Ranging" method ? And will the "Advertising" work even when the device is in the background or thats not possible?
Yes, "ranging" is the way to go for virtual beacons.
Virtual beacon advertising only works in the foreground, that's the limitation of Apple's Core Location API.
Technically you could build your own Core Bluetooth based virtual beacon, as Core Bluetooth API can keep broadcasting in the background -- but I'm afraid this is something we don't officially support and can't help you with.