Android Development : Aksing user to turn on the GPS
Dialog box : Turn on the GPS Recently, in one of my android project work, I needed GPS location of the user device. I wanted it to look like the dialog box which appears in the Google Maps when we turn in on. This is how Google asks user permission for GPS access: So, after referring the Google's official documentation and some more modifications following code worked like a charm. I had integrated the map and the code somewhat goes like this: First you have to add manifest permissions: <uses-permission android:name = "android.permission.READ_PHONE_STATE" /> <uses-permission android:name = "android.permission.INTERNET" /> <uses-permission android:name = "android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION" /> Then edit your MainActivity like this : public class MainActivity extends AppCompatActivity implements ...