I am working on a BLE
(bluetooth LE) app that connects with a hardware device .
I am able to discover and connect to the device, read data from the device,write data to the device.
What i couldn't find on the BLE docs in Apple , is how can you get a notification when you come near a device , when the app is close .
I know how to register to characteristic
notification, but this notification happens only when app is in the background .
I know that iBeacon
can detect a bluetooth while the app is closed, and send notification, but i would like to get notification when a device discover a certain BLE with a UUID
.
iBeacon,is using the BLE with UUID
and major and minor
fields,which i dont need/dont want . I would like just to register to notification from a certain UUID
from a BLE.
I did this, without any respond :
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self initRegion];
- (void)initRegion
{
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"4AD3FADF-F179-4343-0000-000000000000"];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"BLE-NAME"];
[self.locationManager startMonitoringForRegion:self.beaconRegion];
}
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
NSLog(@"ENTER");
}
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
NSLog(@"EXIT");
}