Search code examples
androidlocationandroid-7.1-nougatandroid-8.0-oreo

Turn on location services using code without user input


I am working on phone locator app and need turn on location automatically if off. The scenario is something like if phone is lost, location disabled and internet on, i can turn on the location remotely, find my phone. Need this to work for Android N and Oreo also. Can device administrator do the job or is there any other special permission which will allow me to enable/disable location without any user interaction? Not looking for any prompt from location manager. If there isnt, is there any other way we can achieve same goal?


Solution

  • Yeah this functionality can be achieved on pre-lollipop devices.

    But post-lollipop or marshmallow, devices needs to allow the permissions.