Example usage for android.content Context LOCATION_SERVICE

List of usage examples for android.content Context LOCATION_SERVICE

Introduction

In this page you can find the example usage for android.content Context LOCATION_SERVICE.

Prototype

String LOCATION_SERVICE

To view the source code for android.content Context LOCATION_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.location.LocationManager for controlling location updates.

Usage

From source file:Main.java

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

From source file:Main.java

public static boolean isGPS(Context context) {
    LocationManager lmLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

    Boolean isGPS = lmLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

    return isGPS;
}

From source file:Main.java

public static boolean isGPSLocation(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return locationManager != null && 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);
}

From source file:Main.java

public static boolean isNetworkLocation(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return locationManager != null && locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}

From source file:Main.java

public static boolean isGpsEnabled(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        return false;
    }//from  w  ww.j  av a  2  s .  c o m
    return true;
}

From source file:Main.java

public static boolean isLocationEnabled(Context context) {

    LocationManager service = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    boolean isEnabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER)
            && service.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

    return isEnabled;

}

From source file:Main.java

public static boolean isGPSEnabled(Context context) {
    LocationManager lm = ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE));
    List<String> accessibleProviders = lm.getProviders(true);
    return accessibleProviders != null && accessibleProviders.size() > 0;
}

From source file:Main.java

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