I’m developing an application for iPhone that require server to be always aware of the user location. Does iOS have a feature whereby application (or iPhone device) keep reporting it’s location to external server?
Take a look at the "Tracking the User's Location" section in the iOS App Programming Guide. It tells you how to retrieve location data in the background. In this case, you probably only want to get significant updates.
You should be able to use startUpdatingLocation, then do whatever you want (e.g. a POST request) in the delegate.
Related
I am thinking to make my own app like Find My iPhone app . But I am confused that whether apple allow developers to have access to play with the security or is there such Apple API's that can help us to include features as in the above app. Any suggestions?
Well I just can't comment because of low reputation. But people must give a reason to down-grade a question. Its quite a valid question.
Creating an app like this is semi possible. Due to the fact that you are not allowed to keep running in the background, except for certain special cases. Such as Music or a guidance app (navigation apps)
Your app can register to receive updates from the GPS location and process them.
The problem is it will use your gps all the time.
The find my iphone app is a combination of wifi location/sim card location/gps location.
It uses a combination of all these items which it has to keep track of your location as close as possible. Now back to your question, the fact that you cannot keep running in the background, will mean the app needs to stay open all the time (open I mean running, not necessarily onscreen). Not like the application from apple itself, which of course is allowed to go outside these developer restrictions.
The APIs exist for you to create the main functionality of this app. Core Location and APNS
When use A is looking for the location of user B, A would tell a server that it needs user B's location.
A push notification could fire up user B's app, at which point...
User B's location services would kick in, in the background,
Send this information to your server
Then update user A with another push notification.
I want to find iPhone devices/device tokens within a specific radius from particular location.
For example : Within a 25 K.M. of radius from Sydney,i want to get iPhone devices tokens.
I am working on ASP.NET MVC2 for this.
Let me know,if is there any API for that?
Thanks,
You are only able to get details for devices that you 'know' about. Your app will need to log unique IDs for each device, and your app will need to log known locations for devices. It's then up to you to look up, from your central database, the details of the devices within a certain distance. iPhones can update significant location changes when running in the background but it's up to you to track devices and accept the limitations that that data may not always be correct. eg. If a user falls outside connectivity then you will still have an old location logged for that user.
I'm not aware of a single API that offers this services, if you're coding it then in your app you will need to register devices identifiers and location information to a central server. You will also need to create the lookup to query your data to find devices within a location. I am guessing that you might want to send push notifications, in which case your app will also need to register for notification services too.
There is no way for you to discover devices that don't have your app running and you also do not know who the owner is.
I have created this location tracking app, that uses nstimer in background to fetch location every 4 mins.
I am wondering if there will be any problem in submitting the app in the market place..
If you know something regarding it, can you please let me know.
Thanx.
If it's relevant to what your app is doing I don't think it will be a problem.
This is from Apple's App Store Review Guidelines:
4.1 Apps that do not notify and obtain user consent before collecting, transmitting, or using location data will be rejected
4.2 Apps that use location-based APIs for automatic or autonomous control of vehicles, aircraft, or other devices will be rejected
4.3 Apps that use location-based APIs for dispatch, fleet management, or emergency services will be rejected
4.4 Location data can only be used when directly relevant to the features and services provided by the app to the user or to support
approved advertising uses
But pay attention that if you want your app to keep getting location updates even in background, you need to declare this in your plist file, otherwise when the app goes to background you won't be able to get location updates.
Declaring Your App’s Supported Background Tasks
Support for some types of background execution must be declared in
advance by the app that uses them. An app declares support for a
service using its Info.plist file. Add the UIBackgroundModes key to
your Info.plist file and set its value to an array containing one or
location—The app keeps users informed of their location, even while it
is running in the background.
I've gotten one app through. You have to make sure that the user is informed exactly as to what is going on. So dialogs have to be very specific and have a privacy policy in place.
4 minutes is a little bit extreme if that's a permanent state of your app.. I don't think Apple would allow that if they found it during app review. Would it not suffice to just have it updated based on movement? ie. the significant location change api?
The app I did this for used significant location change api for background location tracking and then stepped it up to higher frequency tracking if the app was actually open.
I have developed a Web application (HTML5/browser based) for a client which requires fairly continuous polling of location information. Client generally uses an iPhone or iPad. The complaint is that the device requests permission to "share location" just as continuously, and wanted to know if there was a way to allow device to "remember" their choice.
The answer is no - not with HTML.
I have this requirement from client where depending on the location of the iPhone we need to send push notification. Now how can we find location of the iPhone without the app running in background? Is there anyway we can achieve this?
With the recently-released iPhone OS 4, I believe this is now possible. See http://developer.apple.com/technologies/iphone/whats-new.html.
Edit: More useful info here. See the section entitled "Starting the Significant-Change Location Service"
no, an SDK app must be running (and therefore in the foreground) to be able to send any location data.
.mac can do this with the locate my iphone feature, but it requires a subscription and as far as I know cant be used by an external application...