androidairplane-mode

How to change Airplane Mode programmatically?


I am following this 2 tutorial. Tutorial 1 and Tutorial 2. But When i run thid project in my Moto G phone its unfortunately stop means after 17 api this is not working & give error

Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE from pid=8675, uid=10233

I set permission in manifest file.

<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<protected-broadcast android:name="android.intent.action.AIRPLANE_MODE" />

I am also checking some solution like Permission Link. I am getting still this error. So, how can i resolve it?

Thanks in advance.


Solution

  • This broadcast can (now) only be sent by a system app, not by an installed app.

    So unless you can get Motorola to sign your app as a system app, you are out of luck.