Reputation: 71
It is possible to active WiFi or mobile internet at the backend from one application? I create an application which needs Internet access. The app should check the Internet connection when it starts. If there is no connection, then turn WiFi or mobile Internet connection on.
Is this possible?
I use the ConnectiveManager to check connectivity state.
Upvotes: 1
Views: 378
Reputation: 33792
You can use setWifiEnabled() to change the wifi state.
If there are no wifi networks configured, it should automatically use the data network if any. Use the ConnectivityManager to check if there are any data networks.
Upvotes: 1