1

I am making an app that when user clicks on toggle button , mobile data gets on , and when clicks another time data gets off, what permissions and codes I should use?

I tried many codes from developer android site and other sites but non of them worked in the way I want.

Ami Bidar
  • 89
  • 2
  • 6

1 Answers1

0

It is no longer allowed to set mobile data state from your app. Instead you should ask the user to turn on it for you, or take him to the screen in settings to turn it on. Latest update on enabling and disabling mobile data programmatically You can also check this discussion on github.It provides a code which works on API levels less than 21, https://gist.github.com/melihmucuk/6817536 . Not sure this is what you want.

Jude Osbert K
  • 940
  • 9
  • 22