Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use the Android Default GPS ON-OFF dialog in My application

In Our application we want to integrate the android Default GPS Dialog. The same dialog that appears when the GPS is OFF and we press of my location button in google map apps. Have also attached the image of the dialog which I want to integrate.

  1. Clicking on "No" option will close the dialog.
  2. Clicking on "Yes" option will Activate the GPS of device directly.

Dialog the appears for OLA app Below (ANDROID L):
enter image description here

Dialog the appears for OLA app Below (ANDROID KIT_KAT):
enter image description here

Dialog the appears for Google Map Below (ANDROID L):
enter image description here

Our existing implementation is when the GPS is OFF we are redirecting application to the default location setting screen of the device from where he/she can turn ON the Location.

looking forward for answers. Thanks in advance.

like image 303
Balu Avatar asked May 07 '15 06:05

Balu


People also ask

How do I turn on GPS automatically on Android?

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.

How do you ask someone to turn on your location?

The, after opening the Trip Advisor app, and tapping the Near me now option, I'm prompted with the second image, where I'm asked to Turn on Location services. After I tap the button, a dialog shows up so I can allow, or disallow, the Location service to be turned on.


1 Answers

You need to use the latest version of Google Play service. latest version has one dialog to activate all required things to get the GPS.

From Android Developer Play Service documentation,

Location settings - While the FusedLocationProviderApi combines multiple sensors to give you the optimal location, the accuracy of the location your app receives still depends greatly on the settings enabled on the device (GPS, wifi, airplane mode, and others). Using the new SettingsApi class, you can bring up a Location Settings dialog which displays a one-touch control for users to change their settings without leaving your app.

Link directs to Play Service version documentation. Version 7.0 has introduced this new prompt.

like image 90
Manish Avatar answered Oct 06 '22 08:10

Manish