Mobile data and GPS ON/OFF programatically - Android above 5.0 too

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Nov 29, 2016 10:06:58 AM via Website

I want to implement Enable/Disable mobile data and GPS settings.
I have searched for available Android API of enable/disable mobile data and GPS settings and below are my findings.

Enable/Disable Mobile data –
1. It is possible to perform enabling/disabling in <5.0 Android OS.
2. From 5.0+ Android OS, It is not yet possible for a non-system app to enable/disable mobile data.
From 5.0 or above we get this exception while doing same – Which is Not for use by third-party applications.
Caused by: java.lang.SecurityException:`Neither user 10314 nor current process has android.permission.MODIFY_PHONE_STATE.

Is there any possible/available solutions available?

GPS Settings -
1. We are able to ON location programmatically but not yet found a way to disable it(excluding Intent approach).

Anyone know how to disable GPS(Location programmatically) without moving to settings via intent.

Thanks in Advance.