The answer to the question here provides the method to activate the location if it has been turned off.
Now, Android has three location settings currently:
- High Accuracy: Uses GPS, WiFi and cellular network to get the location.
- Battery Saving: Uses cellular networks and WiFi to determine the location.
- Device only: Uses GPS to determine the users location.
Checking the location status using the line:
gps_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
I redirect the user to the Activity where he can switch on the location. Now if the user turns on the location in the battery saving mode, will I get the location.
Also, for the redirection I do:
context.startActivity(myIntent)
Is there anyway to call startActivityForResult()
here to verify if the user has turned on the location and depending on that redirect the user to different activities?