0

In my settings I want to have a switch called "use Mobile Data". As the name implies I want to be able to NOT use Mobile Data, but still use WiFi if available. How can I do that?

I found a couple related questions but none that's really answers it. I don't want to check if I'm using mobile data, I just don't want to use it.

Thank you very much for your time and assistance in this matter.

Edit:
I know there is a way to check if my app is connected via mobile data and if thats the case I don't call my code. But I would have to check this multiple times. I wanted to know if there is a way to completely disconnect from mobile data.

ישו אוהב אותך
  • 22,515
  • 9
  • 59
  • 80
Jonas
  • 3,953
  • 4
  • 24
  • 64
  • Possible duplicate of [How do I see if Wi-Fi is connected on Android?](https://stackoverflow.com/questions/3841317/how-do-i-see-if-wi-fi-is-connected-on-android) – m0skit0 May 10 '18 at 21:16
  • This just tells me if its connected via mobile data but does not cut off any mobile data usage. I know I could check if its connected via mobile data and then if thats the case don't call my code but this ways I would have to check it multiple times. I wanted to know if there is a way to completely disconnect from mobile Data... – Jonas May 11 '18 at 13:15
  • *this ways I would have to check it multiple times* - unless you write nice code that shares this check – Tim May 11 '18 at 15:15
  • Thats not what I meant by that. For sure I can have a method like `checkIfMobileData`. But I would still have to check `if (!checkIfMobileData) { ... }` every time I do something with internet, which is quite often in my case... – Jonas May 11 '18 at 18:44

0 Answers0