List of usage examples for android.location LocationManager GPS_PROVIDER
String GPS_PROVIDER
To view the source code for android.location LocationManager GPS_PROVIDER.
Click Source Link
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.jav a2s. c o m*/ 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; }
From source file:Main.java
public static void beginListening(Context ctx, LocationListener ll) { LocationManager lm = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE); if (lm.getProvider(LocationManager.GPS_PROVIDER) != null) { lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll); } else if (lm.getProvider(LocationManager.NETWORK_PROVIDER) != null) { lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ll); } else {/* w w w . j ava 2 s . c om*/ lm.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, ll); } }
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 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 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 2 s. c o m return false; } }
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; // }/*from w w w.j a va 2 s . c om*/ if (gps || network) { return true; } return false; }
From source file:Main.java
public static boolean isLocationEnabled(Context context) { try {// w w w . j a v a2 s . c o m 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 isGpsEnabled(Context pContext) { LocationManager locationManager = (LocationManager) pContext.getSystemService(Context.LOCATION_SERVICE); return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); }
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); }