It wont work on non-rooted phone as they added MODIFY_PHONE_STATE
permission check. This permission is only given to system or signature apps refer-here.
Check the code below from PhoneInterfaceManager:
@Override
public void setDataEnabled(boolean enable) {
enforceModifyPermission();
mPhone.setDataEnabled(enable);
}
private void enforceModifyPermission() {
mApp.enforceCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE, null);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…