-
-
Save crzsotona/70be0d07c222451dc35b5bf26e6172b4 to your computer and use it in GitHub Desktop.
How to grant all permissions at once in marshmallow using shell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Author - Nitesh Tiwari | |
#Github - https://github.com/nitiwari-dev | |
#add your package_name | |
PACKAGE=com.coderconsole | |
#create array with all the permission you need to enabled | |
PKG_ARRAY='android.permission.CALL_PHONE | |
android.permission.GET_ACCOUNTS | |
android.permission.READ_SMS | |
android.permission.READ_CONTACTS | |
android.permission.ACCESS_FINE_LOCATION | |
android.permission.CAMERA | |
android.permission.WRITE_EXTERNAL_STORAGE' | |
#lets exceute our command | |
for permissions in $PKG_ARRAY; | |
do | |
echo $permissions + ' granted' | |
adb shell pm grant $PACKAGE $permissions | |
done | |
echo 'Bingo its done' | |
# Output | |
# $ sh grant_all_permissions.sh | |
# android.permission.CALL_PHONE + granted | |
# android.permission.GET_ACCOUNTS + granted | |
# android.permission.READ_SMS + granted | |
# android.permission.READ_CONTACTS + granted | |
# android.permission.ACCESS_FINE_LOCATION + granted | |
# android.permission.CAMERA + granted | |
# android.permission.WRITE_EXTERNAL_STORAGE + granted | |
# Bingo its done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment