public boolean isGpsEnabled(Context context) {
LocationManager locationManager = ((LocationManager)context.getSystemService(Context.LOCATION_SERVICE));
List<String> accessibleProviders = locationManager.getProviders(true);
return accessibleProviders != null && accessibleProviders.size() > 0;
}
标签:LocationManager,context,可用,与否,isGpsEnabled,locationManager,Context,accessiblePro
From: https://blog.51cto.com/u_16166892/6525379