Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grant PACKAGE_USAGE_STATS permission through adb

Tags:

android

adb

adb shell pm grant x.y.z android.permission.PACKAGE_USAGE_STATS

This is the command to grant PACKAGE_USAGE_STATS permission through adb, but it only works if I have never toggled this permission in native settings.

The same thing happens to SYSTEM_ALERT_WINDOW permission, while there is a better command adb shell appops set x.y.z SYSTEM_ALERT_WINDOW allow to do it effectively.

The problem is I didn't find another command to toggle PACKAGE_USAGE_STATS permission.

like image 421
J.Zhang Avatar asked Oct 30 '25 19:10

J.Zhang


1 Answers

You can set android:get_usage_stats using appops

adb shell appops set x.y.z android:get_usage_stats allow

like image 74
BenWoodford Avatar answered Nov 02 '25 09:11

BenWoodford



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!