Hai Friends..
PLease find us on Facebook for more updates.
This is our new Fab page Url.
http://www.facebook.com/CoderzHeavenFans
By adding us on Facebook, you can get access to our new updates fast and get answers to your questions quickly.
So please add us on Facebook.
Please find us on Twitter also.
https://twitter.com/coderzheaven
This simple code checks whether GPS in enabled in your android device or not.
If the GPS is not enabled the user is redirected to the settings page.
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER);
// Check if enabled and if not send user to the GPS settings
if (!enabled) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
Turn off the GPS on your device and running it will display this screen.
Please test GPS on the device because emulators don’t have GPS. But anyway you can simulate Longitude and Latitude which I will show in the coming posts.
