Dan
Dan

Reputation: 147

What are the APIs used by MobileMe's Find My iPhone?

How does Apple do polling of a phone's location remotely? Is there any API that allows an app developer to do the same with the SDK?

Upvotes: 0

Views: 1476

Answers (3)

mlaster
mlaster

Reputation: 417

I'm pretty sure if you do the "voip trick" your app will be refused from the store. It is only allowed if your app is actually a VOIP app, not just using it as a technique to circumvent background processing restrictions.

Upvotes: 0

tc.
tc.

Reputation: 33592

An iOS device already maintains a connection to one of Apple's push servers if push is enabled, and the server has to know the device on the end of the connection (to determine the push notifications to deliver to it). The easiest way to build on this is to have the server say "tell me where you are!" as a push notification.

The device also hits Apple's servers for other reasons (App Store updates, captive login page detection), but it's less likely that the server can identify the device in these cases.

That said, you can do this with the user's consent:

  • Make your app a background "voip" app (<key>UIBackgroundModes</key><array><string>voip</string></array> I think)
  • At app launch, check that you can retrieve the current location (I'm not sure what happens if you do this while your app is backgrounded).
  • Maintain a "voip" connection to your server.
  • When the server asks the device for its location, ask Core Location for the location again and send it to the server. (I think you also need either "location" in UIBackgroundModes or you need to keep the connection active, possibly in both directions; the former may be easier.)

You won't be able to stop the "location services" icon from appearing in the status bar. The usual multitasking caveats also apply (your app can be killed if the phone runs out of memory; "voip" causes your app to be relaunched sometime later though).

Upvotes: 0

Alastair Pitts
Alastair Pitts

Reputation: 19601

My guess is that they are private, undocumented and probably un-callable api's.

I couldn't imagine the huge security implications of having an external party/app be about to poll a phone location without the users consent.

Upvotes: 5

Related Questions