3

Runtime Android permissions

Recently my ola cabs application, after the latest update, asked for location permission at runtime. It did not open the location settings screen but just by clicking on yes, my location (GPS) of the device was turned on and the application proceeded without going to location settings or any settings screen. This feature was about to come in android M and is available on the MNC preview only, so I am guessing it cannot be used in devices at this point of time. So how is this application implementing this feature?

gopi1410
  • 6,567
  • 9
  • 41
  • 75

1 Answers1

5

It is using SettingsApi in the Play Services SDK 7.0+, to display the location settings dialog.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Oh great! Thanks, didn't know about this :) – gopi1410 Jun 07 '15 at 21:50
  • @gopi1410: FWIW, here is a sample app demonstrating its use, as part of getting periodic locations from the fused location provider: https://github.com/commonsguy/cw-omnibus/tree/master/Location/FusedPeriodic – CommonsWare Jun 07 '15 at 21:52
  • http://stackoverflow.com/questions/30093673/use-the-android-default-gps-on-off-dialog-in-my-application/37246593#37246593 full code – Bhavin Chauhan May 16 '16 at 04:16