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.
- Clicking on "No" option will close the dialog.
- Clicking on "Yes" option will Activate the GPS of device directly.
Dialog the appears for OLA app Below (ANDROID L):
Dialog the appears for OLA app Below (ANDROID KIT_KAT):
Dialog the appears for Google Map Below (ANDROID L):
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.
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,
Link directs to Play Service version documentation. Version 7.0 has introduced this new prompt.
Step By Step
Step 1 check hasGPSDevice Support or not
Step 2 hasGPSDevice true check MarshMallow Permimssion
Step 3 MarshMallow Permimssion true check Location already on or not
Step 4 If Location on then CAll Gps Tracker and fetch Lat Long
Step 5 If Location oFf then CAll Location Dialog same AS Google Maps
Source Code
https://drive.google.com/open?id=0BzBKpZ4nzNzUMnVLTGpWcTk2QUE
Add Dependency and Internet Permission
compile 'com.google.android.gms:play-services-location:8.4.0'
Source Code
https://drive.google.com/open?id=0BzBKpZ4nzNzUMnVLTGpWcTk2QUE
Ola Cabs is using the newly released Settings API to achieve this functionality. As per the new API the user is not required to navigate to the settings page to enable location services giving a seamless integration for the same. Please read this for more details.