Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LocationManager lm = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
- boolean gps_enabled = false;
- boolean network_enabled = false;
- try {
- gps_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
- } catch(Exception ex) {}
- try {
- network_enabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
- } catch(Exception ex) {}
- if(gps_enabled || network_enabled ){
- //Do something.
- }
Add Comment
Please, Sign In to add comment