I have 2 devices, iPhone 5 (act as Beacon) and iPhone 5s (act as Beacon Detector), both with iOS 8.1.
Both device enabled:
- Location Service ( Privacy > Location Service > Always for AirLocate )
- Bluetooth
- Wi-Fi, joining same SSID which has Internet connection (not quite related)
- iPhone 5s has SIM card, with adequate signal strength
- iPhone 5 has no SIM card
In iPhone 5, I installed Apple's AirLocate demo, and config as follow (In Configuration page):
- Enabled: YES
- UUID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- Major: 0
- Minor: 0
- Measured Power: -59
Since the original AirLocate is reported not working in iOS 8 by default, I modified the AppDelegate's didFinishLaunchingWithOptions
with:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// This location manager will be used to notify the user of region state transitions.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
}
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
}
return YES;
}
In iPhone 5s, I installed Beacon Demo and configure as follow (add a new Beacon):
- Beacon UUID: E2C56DB5-DFFB-48D2-B060-D0F5A71096E0
- Major ID: (empty)
- Minor ID: (empty)
- Hello Message: Entry Testing
- Goodbye Message: Bye Testing
However, the iPhone 5 does not show up in iPhone 5s, always claiming "Not In Range". What did I miss?
Screenshots:
Left: AirLocate; Right: Beacon Demo
Update Latest didFinishLaunchingWithOptions:
in Beacon Demo
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Set up Core Location Manager
self.coreLocation = [[CLLocationManager alloc] init];
_coreLocation.delegate = self;
if([self.coreLocation respondsToSelector:@selector(requestAlwaysAuthorization)]) {
NSLog(@"Core Location requesting always authorization");
[self.coreLocation requestAlwaysAuthorization];
}
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
}
// Load any previously registered notifications
[self loadNotificationRegions];
// Override point for customization after application launch.
return YES;
}