Thursday, August 7, 2014

How to get the current location using location manager android

Hi, I developed the Jogging Pal android app and used the following logic to get the current location using network and gps. I created a separate class as a service extended from Service abstract class and implemented it from LocationListner interface. It is better to check the provider status before you get the location unless it will give an exception. Configure the min distance change for update and min time change for update as you wish. Pass theses parameters to location manager's requestLocationUpdates method. For retrieving the current location you can use the getLastKnownLocation method in location manager passing the particular provider. This will give you the current location. When you are using this for indoor activities the results will not be too accurate. And finally make sure that you have added the permission on the Manifest, Jogging Pal / Android

No comments:

Post a Comment