Question

My app connects to a Bluetooth sensor then starts updating the UI based on the notifications sent from said device. I am having a problem with IOS automatically generating a large amount of notification pop-ups when the app is minimized, I think this is due to the frequency at which the sensor is sending data. So I am trying to figure out how to keep the user from being bombarded when they minimize the app. I am trying to tell the device to stop sending data, but I suspect that delegate method never gets called. I have tried adding

[application cancelAllLocalNotifications]

to both

- (void)applicationDidEnterBackground:(UIApplication *)application

and

- (void)applicationWillResignActive:(UIApplication *)application

but still seem to have an issue, any ideas. Thanks

Was it helpful?

Solution

You can use CBPerpheral::setNotifyValue:forCharacteristic: to start or stop getting notification from the said peripheral.

OTHER TIPS

Another option is to use session backgrounding. For that you need to add the bluetooth-central backgrounding mode to the app's plist file. After that the app is going to receive the bluetooth communication events both in foreground and background and no notifications will be generated by iOS. If your app decides it needs a notfification, it can simply generate a local notification (tutorial).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top