android turns off or on mobile network data
- 2020-05-10 18:52:07
- OfStack
As follows:
//android Turn off or on mobile network data (after this, the device cannot surf the Internet, but can make phone calls and send text messages)
public void setMobileDataEnabled(boolean enabled)
{
ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
cm.setMobileDataEnabled(enabled);
}