permission denial
My activity code is
boolean isEnable= Settings.System.getInt(getContentResolver(),Settings.System.AIRPLANE_MODE_ON,0)==1;
Settings.System.putInt(getContentResolver(),Settings.System.AIRPLANE_MODE_ON,isEnable?0:1);
intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state",!isEnable);
sendBroadcast(intent);
That is because ordinary SDK apps cannot send ACTION_AIRPLANE_MODE_CHANGED
broadcasts. If you look at the documentation for that Intent
action , you will see:
This is a protected intent that can only be sent by the system.
Also note that your AIRPLANE_MODE_ON
stuff may not work on API Level 17 (Android 4.2) or higher devices .
And, note that ordinary SDK apps cannot hold the WRITE_SETTINGS
permission. If you are building your own custom Android ROM, you could have apps that hold that permission in that ROM.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.