iOS background location updates - iphone

I have created an app which uses location updates in the background. I have submitted my app to apple but it got rejected by apple on the ground that you are using location updates in background rather than using significant location update and shape based region monitoring.
My app takes location updates and provided user with specific updates, which works perfectly for my scenarios and have made code to better save battery. With Apple's suggested approach the problem I'm getting with significant location update and shape based region monitoring is location accuracy. With significant location update I get events fired for all the region within that cell tower range or say 100 m - 3000 m rather than when user enters a region say lat long with 100 m radius.
I've had many conversations with apple and they don't seem to care about the developers and new technologies they are creating.
Is there any developer who faced same problem of using background location update to do something other than navigation and got accepted or has anyone used significant location update with shape based monitoring to provide precise updates with better location accuracy.
Any help is much much appreciated.

Varun welcome to SO community.
Here is some lines from docs
Any app that requests background location services should use those services to provide a tangible benefit to the user. For example, a turn-by-turn navigation app would be a likely candidate for background location services because of its need to track the user’s position and report when it is time to make the next turn.
So if you are using standard location service and whenever you get updates and you are not doing anything with that update (in terms of user not coding) then there are very high chances that Apple may reject your app, which they already did.
So what's the solution then?
1. Answer is try submitting the app with other approach.
2. Try submitting the app with other name :D
Solution Number 1. Instead of using standard services use significant location service which gives the accuracy of around hundreds of meters say 200-1700 m and track if user is moving near to your spot or far away from your spot.
If user is moving near to your spot and user is around 500m (depends upon you) near to your spot just start standard location services and track where user is going if user enters you spot then show user "Catch you" or if user moves away from your spot (>500m) then stop standard location service and start significant location service.

Related

Is it possible to get distance from user location to specific location in background in IOS?

I need to calculate distance from user location to specific location, when the app is in background, and get a local notification based on that.
Background location tracking is totally possible, and I have already done that, but is it possible to execute a block of code, containing some condition checking and based on that update and get a local notification?
I am not getting any proper solution. Is there any way to do so?
Can you help me please?
Yeah, you can definitely do that. I'm doing it in an app right now. Use significant location changes, or regions, as previously suggested, to keep the pressure off the users battery as much as possible.
We observe regions (and significant location changes where regions are not supported by the device) then check a few things and fire off a local notification if needs be.
We started with a basic prototype to prove the concept and I highly recommend that approach as a way to get familiar with the location and notification frameworks.
Start with the Location Awareness Programming Guide. Most everything you need to know is in there. (Most things that aren't in there are simply impossible for an AppStore app.) See also Tracking the User's Location in the iOS App Programming Guide.
The best tool for what you're describing is likely "Shape-Based Regions." You can basically draw a box on a map and say "when the user enters or leaves this box, let me know." If at all possible, this is the tool you should use. It has the least impact on battery life.
If you absolutely cannot solve the problem any other way, it is legal to request background location delivery with startUpdatingLocation (and the appropriate background mode in Info.plist; see the above docs). An app that tracks your route while you hike would be be appropriate for this kind of setup. But you should avoid it if at all possible since it's a major battery drain.
You will want to update for significant locations in the background: http://mobile.tutsplus.com/tutorials/iphone/ios-multitasking-background-location/. Then you will want to create a location notification based on that.
My issue is that I am not sure if you can create a local notification in the background.

How to do hourly location updates?

I'm building a location-based app, but I hate having the location services icon on. I only need coordinates once per hour, but I can't figure out how to do this without saying the app is a VoIP app. Is it possible to do this in a way that's App Store acceptable?
You can use location in the UIBackgroundModes of your app, see the documentation.
About the location services icon on, I think you should leave it. It's a fair feedback for your user. A user has to know its position is being tracked and leaving the icon on for a few seconds each time the geolocation actually happens wouldn't be fair. (and it sounds like a case of app rejection to me).
As long as you don't have a negative impact on the device battery, the user will be grateful you let it know you're tracking his position.
For instance, apps such as OpenPaths made my iPhone show the location icon on all the time and have no real negative impact on the battery.
I would register for significant location change updates. When updates happen compare timestamp with last update. Use update if time delta > 60 minutes. Worst case: I believe you get the location indicator outline. this tells the user that a kind of tracking is happening — but not all the time, so it' not a battery issue and you don't get too many support requests. Best case: Registering for significant location change update doesn't show the indicator outline. But I am not certain. Completely without icon might just not be possible.

Advice on determining close locations while iPhone app in background

I need some advice for a location based iPhone app.
I'm building an app that informs the user of nearby locations. When the app is in the foreground it will use the normal didUpdateToLocation:fromLocation: method (calculates distance between user and place of interest), but when it is in the background I'm not sure what is the best way to do this.
I'm thinking of creating CLRegions from all the places of interest just before the app goes to the background. If the user enters a region the app will do a local notification and inform the user of the place of interest.
Or I could register for CL significant update, calc distance between user and all the places and notify of any close ones. Maybe not the best solution, the OS might not give me enough time to compute close places?
Has anyone any experience doing the same? any advice?
I think you should register for significant locations updates (cell change events), and then do your math on events. You can do anything on the basis of this event. As per my experience, region monitoring is also dependent on cell change events along with some extra computations which you don't need.
However you need to enable background location updates. For which you need to convince Apple that this background location services are required for your app. As Apple docs say that background location services are only for apps who provide turn by turn navigation.
how to enable background location updating
Understanding background tracking of user's location in iOS

Background GPS in iOS. Is this possible?

I was wondering if it was possible to get the location of the iPhone with an app that isnt running, or at least running in the background. What I want to do is have the iPhone send a push notification when it arrives at a certain coordinate. Is this possible? If so, could someone put me in the right direction?
Thanks,
Ben
Yes, it is possible. Your application can ask to be notified of significant location changes or to simply continue using the GPS while executing in the background. The former—the approach recommended by Apple—uses less power at the cost of accuracy (this blog post indicates that the updates are accurate to roughly 500m), while the latter is as accurate as the device can manage. This is all detailed in the iOS Application Programming Guide and and the Location Awareness Programming Guide.
If you simply want your application to be notified when the device moves into a particular region, you may want to look into CLLocationManager's startMonitoringForRegion:desiredAccuracy:. If the device moves into a particular geographical region, your app is launched (even if it's not running!).

iPhone 4 background location service question

I'm looking into the new background location service options in the iPhone 4 SDK. It allows an app to run in the background and receive location updates from the device.
There are two methods offered. One is a battery intensive mode that continuously gets location updates. The second recommended method sends the app location updates when there has been a "significant location change".
Does anyone know what a significant location change might be? Is a 30 foot walk considered significant, or is a 10 block walk considered significant? I imagine it also depends on the accuracy of the location mechanism being used at the time.
I've recently done some field testing of the new background location service to get an idea of what constitutes a significant location update, what kind of accuracy to expect for the location hits and our general experiences using it.
The results are detailed in a fairly lengthy blog post:
iPhone Background GPS: Accurate to 500 meters, not enough for foot traffic
As Steve Jobs mentioned in the OS 4 introduction, the low power mode uses cell tower triangulation and does not activate GPS unit. Since the iPhone phone module needs to keep a connection to the cell network anyway, there should be no impact on battery life.
Since the precision of a location fix with cell tower triangulation is anywhere between a few dozen meters (in dense city locations) and a few miles, I think 30 ft is not a significant location change. I don't know the specifics, though (and as mentioned by the commenters, the Apple dev forums are the right place to talk about those).