I'm trying to enable the location from application using Settings API
. In location dialog it shows message Use WiFi and cellular networks for location
. On selection of Yes
it is enabling the location but not the GPS
.
But while I was playing with Google Maps
in same device, it displays the message
Use GPS, WiFi and cellular networks for location
as like below screenshot.
And this is enabling the GPS
also. How can I achieve the same as Google Maps
.
Before posting here I hope I have checked all the possible options. Find my tryouts list below.
I have set the priority
as HIGH_ACCURACY
and min interval to 5 seconds
locationRequest = LocationRequest.create();
// Set the priority of the request
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// Set the update interval to 10 seconds
locationRequest.setInterval(1000 * 10);
// Set the fastest update interval to 5 seconds
locationRequest.setFastestInterval(1000 * 5);
Using only FINE_LOCATION
permission
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Also referred few links but nothing gave exact solutions. All I need is I would like to enable the location with HIGH_ACCURACY
by default which enables the GPS
Any help on this?