Monday 9 March 2015

Get Current Location in Android

This android tutorial is to help learn location based service in android platform. Knowing the current location in an android mobile will pave the way for developing many innovative Android apps to solve peoples daily problem. For developing location aware application in android, it needs location providers. There are two types of location providers,
  1. GPS Location Provider
  2. Network Location Provider
Any one of the above providers is enough to get current location of the user or user’s device. But, it is recommended to use both providers as they both have different advantages. Because, GPS provider will take time to get location at indoor area. And, the Network Location Provider will not get location when the network connectivity is poor.

Steps to get location in Android

  1. Provide permissions in manifest file for receiving location update
  2. Create LocationManager instance as reference to the location service
  3. Request location from LocationManager
  4. Receive location update from LocationListener on change of location

No comments:

Post a Comment