This class provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.
You do not instantiate this class directly; instead, retrieve it throughContext.getSystemService(Context.LOCATION_SERVICE).
1. In the MainActivity.java file, add the below line to the import section.
import android.location.LocationManager;
2. Add the below line to the onCreate method. This will declare a LocationManager named myLocationManager.
LocationManager myLocationManager;
3. Compile and run!
Resources:http://developer.android.com/reference/android/location/LocationManager.html