0

How to get GPS dialogbox like google maps in android app and on click yes turn on the GPS in background of the android app anybody can help me with these code. For dialog box you can refer this link https://i.stack.imgur.com/YYHB2.jpg

Mayur Rathod
  • 361
  • 3
  • 13
  • You cannot control the GPS settings from within an app. You can redirect the user to the Android default GPS settings page. – Rachit Sep 25 '15 at 09:27

1 Answers1

0

You cannot control the GPS settings from within an app. You can redirect the user to the Android default GPS settings page. To do that, you must first create a Custom Dialog box.

Then within the onPositiveButton click listener, you must start this activity

startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
Rachit
  • 3,173
  • 3
  • 28
  • 45
  • i tried this but setting page get opened. As example see Google maps app on android phone on positive button click it turn on the GPS automatically.. For reference you can see this image http://i.stack.imgur.com/YYHB2.jpg – Mayur Rathod Sep 25 '15 at 10:29