List of usage examples for android.location LocationManager isProviderEnabled
public boolean isProviderEnabled(String provider)
From source file:Main.java
/** * * @param activity//from w ww .j a va 2s . c o m * @return */ public static boolean isGPSEnabled(Activity activity) { final LocationManager manager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE); if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { return true; } return false; }
From source file:Main.java
public static boolean isGPSEnable(Context context) { LocationManager locationMgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); return locationMgr.isProviderEnabled(LocationManager.GPS_PROVIDER); }
From source file:Main.java
/** * Tells whether location is enabled./* w ww .j a va 2 s. c om*/ * * @param context a reference to the context. * @return true if location is enabled, false otherwise. */ public static boolean isLocationEnabled(Context context) { LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean isGpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); return isGpsEnabled | lm.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 isLocationEnabled(Context context) { try {/*w ww . j a va 2s .c om*/ LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); } catch (Exception e) { e.printStackTrace(); return false; } }
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 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; }
From source file:Main.java
public static boolean isGPSEnabled(Context context) { final LocationManager manager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean isgpsEnabled = manager.isProviderEnabled(LocationManager.GPS_PROVIDER); return isgpsEnabled; }
From source file:Main.java
public static final boolean isGPSOPen(final Context context) { LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); // if (gps ) { // return true; // }/* w ww. j a v a 2 s . c o m*/ if (gps || network) { return true; } return false; }
From source file:Main.java
/** * Check GPS provider/*from w w w . j a v a2 s.c om*/ * * @param context * @return true if enable or false if not */ public static boolean isGPSProviderEnabled(Context context) { LocationManager locManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); boolean value = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!value) { value = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER); } return value; }