Android: various questions about GPS

I am writing my first location-based Android application, but am confused with some GPS api services. Here are some questions I have:

1) To get my current location, I called requestLocationUpdates () with a listener in the onCreate () method of a single action. But what happens when another activity begins and the current activity becomes invisible? Will GPS location update be stopped? If so, how do I save it after switching activity?

2) how accurate is Location.getSpeed ​​()? How is it calculated? Can you tell the difference between a bike and a walk?

3) not a question about android. How to calculate the coordinates of a location, say, 100 meters from my current location?

4) To stop GPS, do I need to delete all listeners that have been registered with the location manager?

Thank you so much!

+3
source share
3 answers

This will not be an exhaustive answer, as I have no experience developing Android, but I just wanted to add my thoughts to your GPS questions:

Question 2: Usually speed is calculated in GPS hardware, simply by dividing the change in distance by the change in time. (see comments below) Speed ​​is usually fairly accurate as long as there is GPS coverage, and you should definitely know if someone is on foot or by bike. You can even tell between normal walking (6 km / h) and slow running (12 km / h).

3: 100 . , . ():

lat 2= asin (sin (lat 1)) * cos (d/R) + cos (lat 1) * sin ( /R ) * COS (θ))
lon 2= lon 1 + atan2 (sin (θ) * sin (d/R) * cos (lat 1)), cos (d/R), -sin ( < > 1 > ) * Sin ( < > 2 > ))

d/R - angular ( ), d - , R -

, JavaScript , , , :

+2
+2

Source: https://habr.com/ru/post/1747732/


All Articles