How to Get the Name of the GPS Location Provider

public static final String GPS_PROVIDER was added in API level 1
Name of the GPS location provider.
This provider determines location using satellites. Depending on conditions, this provider may take a while to return a location fix. Requires the permission ACCESS_FINE_LOCATION.
The extras Bundle for the GPS location provider can contain the following key/value pairs:
satellites - the number of satellites used to derive the fix

1. Set Permission to Allow Location Information

2. In the file, Get a Reference to LocationManager named myLocationManager.

3. Add the below line to the onCreate method. This will save the name of the GPS location provider to a string named myProvider.

String myProvider = LocationManager.GPS_PROVIDER;

4. Compile and run!

Next Recommended Article: How to Declare Location object