I have an Estimote beacon that I am connecting to with my iOS app. I am successfully able to pass parameters like the major id and minor id, but I would also like to obtain the battery level and proximity and pass those along in the URL as well.
I have read through the documentation and it seems like there is a way to do this, but I haven't been able to figure out how to write it into this method. Any ideas would be extremely helpful!
-(void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons
inRegion:(ESTBeaconRegion *)region {
if([beacons count] > 0) {
if(!self.selectedBeacon) {
self.selectedBeacon = [beacons objectAtIndex:0];
}
else {
for (ESTBeacon* cBeacon in beacons) {
if([self.selectedBeacon.ibeacon.major unsignedShortValue] ==
[cBeacon.ibeacon.major unsignedShortValue] &&
[self.selectedBeacon.ibeacon.minor unsignedShortValue] ==
[cBeacon.ibeacon.minor unsignedShortValue])
{
self.selectedBeacon = cBeacon;
}
}
}
NSString *connectedToBeacon = [[NSUserDefaults standardUserDefaults]
stringForKey:@"connectedToBeacon"];
if ([connectedToBeacon isEqualToString:@"FALSE"]) {
NSString *userId = [[NSUserDefaults standardUserDefaults]
stringForKey:@"userId"];
NSString *beaconURL = [NSString stringWithFormat:@"%@/directory/page.php?
major=%i&minor=%i&user=%@", curr_host_variable,
[self.selectedBeacon.ibeacon.major unsignedShortValue],
[self.selectedBeacon.ibeacon.minor unsignedShortValue], userId];
NSData *BeaconURLResult = [NSData dataWithContentsOfURL:[NSURL
URLWithString:beaconURL]];
}
}
}