I am fetching Latitude and Longitude through network
It is giving me latitude and longitude but what if my NETWORK LOCATION PROVIDER
is unchecked
It will never provide me the Latitude and Longitude of the current location.
What i want is, How Can I enable the NETWORK LOCATION PROVIDER
in phone without knowing
user that It is opened,
How can i do that?
What i have tried is:
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(intent, 1);
But this will open the page in my phone to check it i want to check AUTOMATICALLY
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.phone", "com.android.phone.Settings");
startActivity(intent);
Open your phone's Settings app. Under "Personal," tap Location access. At the top of the screen, turn Access to my location on or off.
A source for obtaining the location of a mobile device. Satellite-based GPS is the major location provider. Assisted GPS (A-GPS) uses the cellular system, which knows where a phone is at all times, and cellular base stations report their cell location number (CELL ID) to pinpoint a device.
Programmatically we can turn on GPS in two ways. First, redirect the user to location settings of a device (by code) or another way is to ask to turn on GPS by GPS dialog using LocationSettingsRequest and SettingsClient.
It is impossible to enable the network provider location automatically as already mentioned. The correct way is to display a box and redirect the user to the settings page. You can enable GPS by using a slight hack as mentioned here. Still I wouldn't suggest doing that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With