Example usage for android.location LocationManager isProviderEnabled

List of usage examples for android.location LocationManager isProviderEnabled

Introduction

In this page you can find the example usage for android.location LocationManager isProviderEnabled.

Prototype

public boolean isProviderEnabled(String provider) 

Source Link

Document

Returns the current enabled/disabled status of the given provider.

Usage

From source file:Main.java

public static boolean isOpenGPS(Context context) {
    LocationManager manager = (LocationManager) context.getSystemService(Activity.LOCATION_SERVICE);
    return manager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

From source file:Main.java

public static boolean isGPSAvailable(Context context) {
    LocationManager alm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    if (alm.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
        return true;
    } else {//from w  w w. ja  va 2s  .c o m
        return false;
    }
}

From source file:Main.java

public static boolean isGpsOpened(Context context) {
    LocationManager alm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    if (alm.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) {
        return true;
    } else {/*from  w  w  w. j  a va  2s.c om*/
        return false;
    }
}

From source file:Main.java

public static boolean displayGPSStatus(LocationManager locManager) {
    boolean gps_enabled = false;
    try {// w  w w  .  j  av a 2s.c  om
        gps_enabled = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    } catch (Exception ex) {
        Log.i("GPSStatus", " checking GPSStatus throws error " + ex);
    }
    return gps_enabled;
}

From source file:Main.java

public static boolean isNetworkEnable(Context ctx) {

    LocationManager locationManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
    return locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}

From source file:Main.java

public static boolean displayNetworkStatus(LocationManager locManager) {
    boolean ntw_enabled = false;
    try {/*w  w  w  .  j  a va  2s .  c o  m*/
        ntw_enabled = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
    } catch (Exception ex) {
        Log.i("NetworkStatus", "checking NetworkStatus throws error " + ex);
    }
    return ntw_enabled;
}

From source file:Main.java

public static boolean checkLocationService(String providers, Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return locationManager.isProviderEnabled(providers);
}

From source file:Main.java

public static boolean isGPSEnabled(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

From source file:Main.java

public static final boolean isGPSEnabled(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

From source file:Main.java

public static boolean isGpsProviderEnable(Context context) {
    LocationManager locationManager = ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE));
    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}