天道酬勤,学无止境

adb-shell

Understanding command through adb shell and through code - Android

Question I am trying to give BATTERSTATS permission to an app. When I run the command from a PC - it works just fine: adb shell pm grant com.example.sample.myapplication android.permission.BATTERY_STATS But the same pm grant command does not work when run from Android app: java.lang.Process process = Runtime.getRuntime().exec("pm grant com.example.sample.myapplication android.permission.BATTERY_STATS"); Does it require root permission to give this permission? If it is so, why it does not require the device to be rooted to run it via adb shell? I am new to Android, please explain a bit more

2021-04-15 11:24:55    分类:技术分享    android   linux   shell   adb   adb-shell