iOS SDK Notification Demo

I am using iOS SDK to work with my application and I found that Notification Demo is not working even when I go far away from the region or entering back. Please Advice asap.

You should put the code of post notification in the AppDelegate or the object which will be created when the app starts. for example, the rootviewcontroller

The code is already there in the appdelegate. m file

If your iOS version is iOS 8, you should register local notification first

Yes, In my development Profile, I have registered it

  • (void)beaconManager:(ABBeaconManager *)manager didEnterRegion:(ABBeaconRegion *)region
  • (void)beaconManager:(ABBeaconManager *)manager didExitRegion:(ABBeaconRegion *)region

these both delegate methods are not called

Even in the AprilBeaconDemo app , its not working

Can you paste your code of how to use the ABBeaconManager?

Same as ur demo provided:

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // Override point for customization after application launch.
    self.beaconManger = [[ABBeaconManager alloc] init];
    self.beaconManger.delegate = self;
    if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
    }
    return YES;
    }

  • (void)beaconManager:(ABBeaconManager *)manager didEnterRegion:(ABBeaconRegion *)region
    {
    NSLog(@“From App Delegate1”);
    UILocalNotification *notification = [[UILocalNotification alloc] init];
    notification.alertBody = @“Enter monitoring region”;
    notification.soundName = UILocalNotificationDefaultSoundName;
    [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    }

  • (void)beaconManager:(ABBeaconManager *)manager didExitRegion:(ABBeaconRegion *)region
    {
    NSLog(@“From App Delegate2”);
    UILocalNotification *notification = [[UILocalNotification alloc] init];
    notification.alertBody = @“Exit monitoring region”;
    notification.soundName = UILocalNotificationDefaultSoundName;
    [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    }

You should call startMonitorForRegion method of ABBeaconManager

In the appdelegate file or in the viewcontroller?

Even in your AppDemo, I am not getting any notification from NotificationDemo.

anywhere .
but the delegate method should in the object which will be created when app starts

Check this class of our demo
ABNotificationViewController

Yes Man, I am talking with the same class and the notifications are not working.

Also that I wanted to know that in the single view controller, is it feasible to get Battery Status , Mac Address as well as Current updated Distance of the Beacon from the iPhone device? Because after connecting device I am not getting Distance and before connection I am not getting Mac Id and Battery Status. Can you refer me the classes by which I can get these 3 fields at a time?

Please Consider and Advice as soon as possible

Sorry, you can;t get that 3 at a time.
because the mac address and battery just can get when the device is connected.
the protocol of iBeacon is standard of Apple

From your original code, I can’t see the startMonitorForRegion method be called

@Rose: Hey Rose, But in Android version, we are getting battery status, mac address, and updated distance of the iBeacon at same time. So why we are not getting in iOS version ? And one more thing I didn’t understand is that , you have said that “the protocol of iBeacon is standard of Apple”. I didn’t get this point. Can you elaborate it please ?

Thanks.

In Android version, it can getting the complete advertising data and mac address. So we can parse out the battery status in advertising data.

For iOS version, we have no way to get the complete advertising data. So we must connect the beacon to fetch the status.

Hey, I am using the AprilBeaconDemo App and now I am not getting any device list for available beacons in the Demo App as well as in my Application. The same devices are detectable in the Android Demo. Please advice.

What’s your iOS version?