Geo Notification on app that is off - ios

Geo Fencing is praised by many, yet I could not easily find an answer to the following.
iOS and/or Android, does an inactive app send you notifications if you are close by?
My question is probably more like: is there an underlying system that knows your app needs to check for your location against the in-app locations and does so despite the app not being active.
Forget the settings where you can switch off geolocation for particular apps, let's assume that is switched on.
But let's assume I just switched my iphone on, no app is running yet. So I am carrying that sleeping phone in my pocket. Would I receive location notifications?
I am currently testing this with Highlight, but maybe someone knows the code/tech side to this answer.

Varies by OS.
On Android, apps can run as a service that are automatically started when the phone boots up. In this case, the user does not need to start the app. So, on Android, yes you would receive location notifications in sleep mode. See http://developer.android.com/guide/components/services.html or https://stackoverflow.com/questions/9866970/tutorial-for-android-services for more info on Android Services.
On Apple, I'm not so sure about running apps as a service like Android. However, I believe there are events that apps in the background can register for. So again, the app (once started) would receive notifications in sleep mode.

Related

iOS background service using BLE after reboot

I'm new to mobile development, before eventually deciding where to develop (android/ iOS) a specific application I have a question (I'd prefer using an iPhone):
So the background is that I have a BLE device frequently sending data to the phone and let the phone app sync the data to the cloud. Now, it is really important that if for some reason the phone has to restart, it will automatically proceed receiving the BLE data.
Is it possible at all in iOS to start a background process (handling BLE packets) after reboot automatically. Thus e.g. when the respective BLE device pairs to the phone after a reboot, that the background process starts automatically, without the user having to start the app manually?
Doing some research I came up with mixed results regarding this scenario and would be grateful if someone with iOS experience could clarify.
(BTW: It does not have to be an Apple App Store Application)
A Few days ago I was working on BLE devices Beacons we supposed to make mobile application and start monitoring these beacons and send date monitoring to API.
This works fine in background, even the user was not running the application in foreground or reboot his iPhone.
All we should do is put the monitoring code at the appDelegate of the application to work in the background.

NSNotification on device reboot

Is there a way to know when the device is rebooted in ios, like "BOOT_COMPLETED" permission in android. Went through internet and could not find and appropriate answer. Any help would be appreciated.
https://github.com/lithium3141/BootLaunch
You can refer this page but one think, if your app doesn't have voip feature means Apple will reject your application.
Apple State in their document:
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW1
UIBackgroundModes
voip-The app provides Voice-over-IP services. Apps with this key are automatically launched after system boot so that the app can
reestablish VoIP services. Apps with this key are also allowed to play
background audio.
remote-notification-The app uses remote notifications as a signal that there is new content available for download. When a remote
notification arrives, the system launches or resumes the app in the
background and gives it a small amount of time to download the new
content.
This value is supported in iOS 7.0 and later.
voip key is the technique used most of the voip applications like skype.

Can I communicate with a slave BLE even if app is not running?

I am developing an iOS application that communicates with a slave BLE device. I know iOS will allow my app to run in background to communicate with BLE. What my doubt is that is there any way to turn on my app if there is any BLE near by? I mean even if my app is not running can I communicate with BLE? Like location service works,i.e., if the app registered for a significant location change alert then app will get automatically turned on when there is a significant location change even if app is not running.
I have searched a lot, but couldn't find any helpful documentation. Any help is greatly appreciated..
There are a few things here and I think you have to be careful with terminology. Let's first clarify "Not running". The app has 5 modes it can be in:
Foreground: the app is "live" and on the screen
Background - unlocked: the app is "live" but not on the screen. There is either another app on the screen (front) or possibly the user is on the home screen, browsing his/her apps, etc..
Background - locked: self explanatory
Terminated by user - still on device: The user has double clicked the home button and flicked your app up (iOS7) to close it.
Terminated by system - still on device: The app has been terminated by OS because of memory pressure (other apps needed the memory space).
Obviously, if the user has deleted the app from the device then there is nothing to discuss.
In option 4, the app is still on the device but will not relaunch any of its background services (BLE, location updates, etc..) until the user relaunches the app. This is new iOS7 behavior. If the user terminated the app then he/she does not want it running.
In option 5, because the user has not terminated the app; the OS will relaunch the app background services as it receives callbacks.
In order for an app to run in the background, it requires that you add the appropriate background modes to its plist or simply click on project (top left) and go to "Capabilities" and enable "Background modes" and the appropriate background mode. In your case: "Uses Bluetooth LE Accessories".
Now you seem to be looking for "Scanning" versus connecting and exchanging data and in my experience, scanning will only work in scenarios 1 and 2 and 5. Not 3. I have tried many times to get scanning to happen while phone is locked with no luck.
Now the way, fitbit etc... work in the background is that the app, scans, discovers services and characteristics and "setup updates" between the phone and accessory while the app is in the foreground. Once this setup is done, the "value of interest" updates (heart beat, etc..) can happen between the BLE acessory and the iOS device, in the background (locked and unlocked).
Hope this helps.

App that works as iBeacon. How to be discovered even with the app has terminated?

I'm trying to use iBeacon in background mode and works fine, but I want that the app works when has been terminated by the system. It's possible to do this?
Thanks!
It is possible to write your app so it launches into the background when LocationServices sees an iBeacon, even if your app is terminated. See my answer here: https://stackoverflow.com/a/19128781/1461050
It should just work, unless the user removes the app. It's not the app itself that shows the beacon, it is the operating system showing the beacon on behalf of the app. That doesn't change when the OS terminates the app, only if the user does it.

Toggle iPhone Charging through OS X or XCode

I'm currently writing an iOS application and am receiving battery status change notifications. Of course, when I'm debugging my app it would be nice if I could toggle the battery status without unplugging my phone. Is there any way to do this via OS X or XCode, that is, while having the phone plugged in tell it to stop charging so I can test my notifications and actions?
Due to Apple's sandboxing regulations and firmware, you can not tell the phone to stop charging. This is a service extremely close to the core of the phone, and it can not be programmatically accessed.
Of course, when I'm debugging my app it would be nice if I could toggle the battery status without unplugging my phone.
Since you can't do that (per the accepted answer), an alternative that will help you debug is to create and send your own battery status notifications. The notifications are regular old NSNotification objects, and you can create and send your own with the name set to UIDeviceBatteryLevelDidChangeNotification or UIDeviceBatteryStateDidChangeNotification. That should let you trace through any code that would normally run when your app receives those notifications.

Resources