Last active
July 1, 2023 04:45
-
-
Save nitiwari-dev/90df91e3eb21864ca711b271e071b77b 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' |
where i should put this file??
@vikasrairajput. You can run with following command on shell i.e $sh grant_all_permissions.sh
.So this script will ensure all the permissions are granted without the user intervention. Note: This is only for developer who do not wanted to click allow button every time. Let me know in case of any issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above shell script allow all the permission at once without clicking at 'allow' button every time. Really helpful to get rid of clicking the dialogs.
Before

After
