What happens when app registers for location updates? - ios

I just wanted to know what happens, when i select app registers for location updates under "Required background modes" in Xcode for an IOS app.
VOIP provides aliveTimeOutHandler for specific duration. In same way, whether location services provides any aliveTimeOutHandler method? I am using IOS7

When your app registers for location updates it will periodically check for location changes when in the background. Of course this is just a switch in project settings that enables that bground mode for your app. You need to actually implement the background task (write some code). You can see the accepted answer here on how to achieve this.

Related

No Background Updates on iOS 9

I am implementing an App with continuous background updates on iOS 9. Even with allowsBackgroundUpdates set to YES, AlwaysUsage Description and with proper authorisation i am not getting location updates continuously. I am using Standard Location Services and Significant Location Services but not receiving any location updates when App is in Background. (App is in background/suspended but not terminated). Can anyone let me know if i have missed anything? Thanks in advance.
If your iOS app must keep monitoring location even while it’s in the background, use the standard location service and specify the location value of the UIBackgroundModes key to continue running in the background and receiving location updates. (In this situation, you should also make sure the location manager’s pausesLocationUpdatesAutomatically property is set to YES to help conserve power.) Examples of apps that might need this type of location updating are fitness or turn-by-turn navigation apps

Location Services in iOS 8: Background Modes

There is a Background mode called Location Updates.
If I include the CoreLocation framework, and in my info.plist include the key NSLocationAlwaysUsageDescription and the value being a String with whatever I need to use it for, do I need to tick the background mode for Location Updates? Can I just use it upon authorization? I've tried looking up iOS 8 guides for Core Location as I've never used it before, but nothing touches on this. I don't know what it is used for if you don't have to tick it for getting location in the background.
When you get authorized for the AlwaysUsage, you can get location whenever your code is running. But it won't run on background unless you have activated an appropriate mode for that.
Apple's Programming Guide describes the philosophy of background modes pretty well.

iOS8 CoreMotion get updates from startActivityUpdatesToQueue when the app is suspended

The handler block is executed on a best effort basis and updates are not delivered while your app is suspended.
the Doc says that the handler block will not be delivered when the app is suspended.But what I want to do is to get user motion activity background and give user a local notification at some time.Any other solutions or which background mode should help?
You can use location updates background mode to keep your application alive in background.
Add NSLocationAlwaysUsageDescription in your plist file.
In Capabilities enable Background Modes and inside that enable Location Updates
Add a location manager and always keep it running
NOTE: This can get your app rejected by apple so make sure you also have some use of location updates in your app.

wake up app by region monitoring or signifiacant location change and start location services

My Question is regarding Location Background Services.
I have a situation where i need my app to continuously run in background and provide location updates. Even if app is quit by user/OS, i need the region monitor or significant location change to start my app and then switch to location background service to provide continuous updates.
Is this functionality achievable on iOS?
With iOS you can set background modes for location updates in Info.plist file by just adding a key named "Required background modes" its an array and set its item 0 to "App registers for location updates", this will make your app to continues location updates even if app is in background. But for quit option apple doesn't provide any such facility you can read apple's documentation for this.
https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4
They wrote: "A suspended app does not execute any code and therefore cannot process notifications related to orientation changes, time changes, preferences changes, and many others that would affect the app’s appearance or state."
Which means once we quit our app it is in suspended mode and thus can not monitor for location updates once its suspended.

Play background music would be rejected by Apple Store?

I produced a pedometer program in ios.I want it can work in the background,But I found it would interrupt finally.So I add a AVAudioPlayer and play a silence music when in the background and it works right.
Now I want to submit to the App Store.I worried that I would be rejected.can anybody tell me about sth?
If this way doesn't work,How can I run a pedometer in the background?
(ps)I need to support the device without M7
Yes you will be rejected. You cannot do tricks like that just so you can have your application run in the background. It's like declaring your application as a VOIp app just so you can run background processes.
I suggest you have a legitimate feature that requires the background process otherwise your application will be rejected.
Have a look at this link and search for the heading UIBackgroundModes to see the 6 UIBackgroundMode keys:
UIBackgroundModes (Array - iOS) specifies that the app provides specific background services and must be allowed to continue running while in the background. These keys should be used sparingly and only by apps providing the indicated services. Where alternatives for running in the background exist, those alternatives should be used instead. For example, apps can use the signifiant location change interface to receive location events instead of registering as a background location app.
I do feel that you can have your application run in the background if you use some location services in your application. Then, quite possibly, could you register your application under the location's key:
The app provides location-based information to the user and requires the use of the standard location services (as opposed to the significant change location service) to implement this feature.

Resources