Monday, 25 July 2011

GPS availability

How to check if GPS is enabled on the device or not.

public static boolean isGpsEnabled(LocationManager manager){
        if ( !manager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
            return false;
        return true;

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 Use this for network-based location.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 Use this for GPS based location but it includes network-based location property too.

No comments:

Post a Comment