Example usage for android.location LocationManager NETWORK_PROVIDER

List of usage examples for android.location LocationManager NETWORK_PROVIDER

Introduction

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

Prototype

String NETWORK_PROVIDER

To view the source code for android.location LocationManager NETWORK_PROVIDER.

Click Source Link

Document

Name of the network location provider.

Usage

From source file:Main.java

private static boolean isNetworkBasedGpsEnabled(LocationManager locationManager) {
    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  av a  2  s. co 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 isLocationEnabled(Context context) {
    LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
            || lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

From source file:Main.java

public static String getLocation(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    String provider = LocationManager.NETWORK_PROVIDER;
    Location location = locationManager.getLastKnownLocation(provider);
    return location.getLatitude() + ":" + location.getLongitude();
}

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 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 isGPSEnabled(Context context) {
    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
            || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}

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 isOpenGPS(Context context) {

    LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
    boolean isGPSEnable = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    boolean isNPEnable = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

    if (isGPSEnable || isNPEnable)
        return true;

    return false;
}

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;
}