Timo Cengiz
Timo Cengiz

Reputation: 3417

How to get live data from Maps like Speed, location? Is it possible?

So I got a question I don't know if it is possible or not.

I have searched around the web for a while but I could not find anything.

So I have an application that opens Maps app pragmatically when a situation occurs. My question is later when that user is redirected to the Maps app can I get live data feed like speed as it is changing or other values?

Examples or links would be nice if there is such a way to do it

Upvotes: 0

Views: 287

Answers (1)

Armin
Armin

Reputation: 1150

I recommend the following:

  1. Use the MapKit framework and a MapView inside your own app instead of redirecting the user out of your app.

  2. If you absolutely have to redirect the user out of your app, then you have to ask for permission from to user to use their location data while your app is in the background. Since they're in Maps and not in your app, you're using their location data in the background. You can read this article on requesting for permission in iOS 8.

  3. Get location data by using CoreLocation's CLLocationManager, and implementing the CLLocationManagerDelegate protocol. There's a delegate method which gives you CLLocation objects, which in turn hold properties such as speed, course, etc.

Here's an EXAMPLE for using CLLocationManager.

Upvotes: 1

Related Questions