Alireza Ahmadi
Alireza Ahmadi

Reputation: 5338

Can't broadcast ACTION_AIRPLANE_MODE_CHANGED for a system app

I developed an app and copied it to /system/priv-app in a rooted Android device to make my app a system app and It works But still when I try to run below code I get an exception that only system can broadcast this.

val newIntent = Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
newIntent.putExtra("state", false)
sendBroadcast(newIntent)

My Android version is 7.1.1 is there any workaround for this? I want to broadcast this after changing the airplane mode with this code

Settings.System.putInt(contentResolver, Settings.System.AIRPLANE_MODE_ON, 0)

Upvotes: 0

Views: 757

Answers (1)

Larry Schiefer
Larry Schiefer

Reputation: 15775

Your app has to be signed by the platform key and also assigned the system user (specified in the manifest.) Placing the app in /system/priv-app does not grant it any special functionality.

Upvotes: 1

Related Questions