This question already has an answer here:
How can I identify that if the location turned off by the user in android? I also want to show a dialog to go to settings.
This question already has an answer here:
How can I identify that if the location turned off by the user in android? I also want to show a dialog to go to settings.
You can trigger a broadcast receiver to know the gps is turned on/ off.
answer is here : How to trigger broadcast receiver when gps is turn on/off?
to check if gps is on or off : How to check if GPS is Disabled Android
This is a quick tool to check if device location is enabled or not, Hope this helps.
This will return a boolean indicating enabled or not.
And you can navigate not location settings by using the following intent from the alert dialog click listener,