Apple disallowing background location tracking which is critical to business use case - ios

We have an app that tracks riders in the field and as per their current location and some other parameters assign them deliveries. For this, even when the user is not currently using the app, background mode or device locked, we need to keep track of their location after every x seconds.
Now, we have explained the complete business use case to Apple but they keep coming back with the same response:
Thank you for information. We still need a demo video that shows a
“Background Location” feature (Such as: turn-by-turn navigation,
bread-crumbing) when the app runs in the background.
We still do not see a “Background Location” feature (Such as:
turn-by-turn navigation, bread-crumbing) within your app in the demo
video your provided. If the app does not have this feature, please
kindly use the foreground location instead. please remove the
“location” setting from the UIBackgroundModes key if your app does not
require persistent real-time location updates. You may wish to use the
significant-change location service or the region monitoring location
service if persistent real-time location updates are not required for
your app features.
I wonder how does Uber and other ride sharing/location based apps go around this app for their drivers

You haven't really asked a question above (likely why someone downvoted). You've mostly just posted a complaint about Apple's review process. You've not explained why it's critical to get it every few seconds. And you haven't mentioned why Apple's suggestions don't work/aren't good enough.
Here are some general points around the area you have mentioned that should be useful
Background location:
If you want to allow your app users to close your app, you can use "significant-change location service" to allow your app to detect when the device has moved a lot, in a much more battery efficient way. You get ~10 seconds to ping a server and restart the request for the next time. Apple mentioned this in their response to you, please check it out: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
"I wonder how does Uber and other ride sharing/location":
They don't do what you are trying to do first of all, they encourage their drivers to keep the app open at all times for optimal performance. Again Apple mentioned this in their response. Your app is not providing any use to the app user while in the background and tracking location. So either keep the app open and track location (How to prevent screen lock on my application with swift on iOS) or, rely on significant change location events in the background
Again as Apple said in their response, if 1 or 2 above doesn't address your needs (likely they do), you need to implement a feature such as turn by turn directions in the background, in order to justify why you need this data. Users also need the ability to turn this off, so that it can't be abused by the developers.
Apple doesn't allow apps to just track whatever they want due to privacy issues. There is no way to get around this, you'll have to do one of the above.

Related

Is it possible to retrieve data from the Settings App?

Is it possible to access the data contained within the Battery view inside of the Settings App. More specifically, I am interested in the amount of time that has been spent on screen for each application.
I saw this app as well and was wondering how it works so I downloaded the app and the Moment app actually uses as notification to prompt you to screenshot the battery life each day which I assume it then uses OCR to read the data from the screenshot.
See attached images for the detailed app flow.
Not really, the information you want are from Private API's and unfortunately apple doesn't allow it.
But you can get some basic information and notifications related to battery settings like:
Battery State
Battery Percentage Level
Battery Monitoring - Enabled / Disabled
For more reference check this Link.

Is using Core Location for performing functionality in the background appropriate?

Lately, I've notice that there are a few applications request to access the user's location for performing some functionalities in the background.
For example: Application for scanning and uploading the user's photos for backup purposes, so when entering the background state, it keeps scanning and uploading.
What am I asking:
If there are Background Execution mechanisms for executing Background Tasks (Select Target -> Capabilities -> Background Modes), so why using the Core Location for doing such a thing?
If using Core Location is different, what is the benefit of using it?
Also, I've read (and this is what I assume) that using the core location for not what is meant should causes to let the application to be rejected, the weird thing that -as I mentioned- there are a few applications doing this! I feel a little confused about it.
Also, I've read (and this is what I assume) that using the core location for not what is meant should causes to let the application to be rejected, the weird thing that -as I mentioned- there are a few applications doing this! I feel a little confused about it.
You are right to be in doubt. Do not imitate this behavior. These people are misusing CoreLocation as a way of getting their code to run in the background even though they are not really using any CoreLocation features.
You are not allowed to do things arbitrarily in the background — and with good reason. Don't violate the rules. If you want to keep uploading even when in the background, use a URLSession with a background URLSessionConfiguration. Do things the right way.
Edit: To remove any doubt: I do not recommend the following approach, in fact, like #matt I highly discourage anyone from using this or a similar approach. Please see my comment below for a better way to update the app in the background.
To answer the OP question:
You can ask CLLocationManager to get significantLocationChanges. This will not only notify you and give you CPU time in the background, but will actually launch your app (even after phone restart!) to let you know of the location changes.
This is a pretty good way of promising yourself some extra processing time in the background (although like you said - it's a very bad "app behavior" and may even cause your app to get rejected from the AppStore)
AFAIK the first app to do this was Dropbox - they had a whole screen in settings explaining why they ask you for location just to backup your images... since iOS doesn't have any event (for 3rd party devs) for informing an app on changes in the device photos, Dropbox solution was to get "woken" on those location changes and check themselves for changes, if they found any - they would upload the new images to Dropbox in the background.
significantLocationChanges only uses low-power methods such as cellular towers and nearby Wifi and therefore is pretty easy on the battery. The processing itself however can be intensive, depending on the app that takes advantage of this method.

The background to locate for iOS

We because of the functional requirements of the application of rules in 30 minutes to the server upload a local position, so I used in the project background, but submits to apple for review has been rejected,Then I shall, in accordance with the apple to add their prompt solution in the description of application of power loss of battery and so on, but still with the reason to refuse me, I really can't understand, what a great god met this kind of problem?
Reason:
2.16 Details
Your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not declare any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.
Next Steps
Please revise your app to include features that require the persistent use of real-time location updates while the app is in the background. Please also add the following battery use disclaimer in your Application Description:
"Continued use of GPS running in the background can dramatically decrease battery life."
If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.
Welcome to SO.
Your post is an unintelligible mess. You need to craft clear English language sentences that explain why you need background location services, and you also need to add language that warns the user that your app will reduce the user's battery life, as they explained to you.
It sounds to me like you are saying that your app needs to send updated location information to your server every 30 minutes even when it is running in the background.
If so, you need to explain that, and explain why you need to do that.
I gather that English is not your native language. You might need help from somebody who is fluent in both English and your language to translate your explanation so you can submit it to Apple.

Require user to be in particular area for app to load

I have been looking into getting the user's location and then verifying they are in a particular building, and then loading the app. I have been experimenting with CoreLocation but cannot find any cases where this location verification is true. I was thinking the easiest way would be an if/else statement but I need the location to do that. I want this to be compatible with as many iOS devices as possible, so backwards compatibility is something I am interested in too.
This is simple to do, there are tons of tutorial that'll show you how to do this. The gist of it is:
Register app to use location in the background.
Ask permission to use location all the time.
Create the region that you want to use to wake the app up.
Start monitoring for location changes to that region.
The app will relaunch when the user enters that region and calls appDidFinishLaunching, then you can do your thing.

GPS location tracking of others in Corona SDK

I am building an iOS app in Corona SDK and am trying to implement a map feature where the user can see where they are compared to where others with the app open are. What would be the best way to go at this?
I already wrote the code for finding the current location of the owner of the device, but how do I retrieve data from other users?
Any advice is greatly appreciated!
This is very broad question, but basically you need a server (on the web) where each user's location gets stored while the app is open, and the app can request the location of other users specifically, at some time interval. Presumably you would need to have some form of rights management since every user would typically be interested in seeing only a small number of other users, and every user would want to have control over who can see their location.
One thing to remind users of is that the reported position is that of the device, not that of the user, and that it is the last reported position, not necessarily current (not all devices are on cellular network or wifi at every moment), so you'd also want a time-of-last-update to be shown with every location marker.

Resources