Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cannot grant GET_ACCOUNTS permission #25

Closed
tontongg opened this issue Dec 6, 2017 · 9 comments
Closed

Cannot grant GET_ACCOUNTS permission #25

tontongg opened this issue Dec 6, 2017 · 9 comments

Comments

@tontongg
Copy link

tontongg commented Dec 6, 2017

[...]\AppData\Local\Android\sdk\platform-tools>adb shell pm grant com.kazucocoa.droidtesthelper android.permission.GET_ACCOUNTS

Operation not allowed: java.lang.SecurityException: Package com.kazucocoa.droidtesthelper has not requested permission android.permission.GET_ACCOUNTS

I am running app on Android 7.0

Some logs :

12-06 09:58:37.373 27718-27718/? W/Activity: Can reqeust only one set of permissions at a time
12-06 09:58:37.373 27718-27718/? E/HandleAccountHelper: Can't granted Manifest.permission.GET_ACCOUNTS

@KazuCocoa
Copy link
Owner

Did you run it on a real device?

The following is running on the emulator and in this case granted permission works fine.
Could you check "Permissions" section and see "Contact" permission there?

image

@tontongg
Copy link
Author

tontongg commented Dec 8, 2017

Yes, real device (honor 5c)
Permissions section in the app info are empty (no Contact permission appear)

@KazuCocoa
Copy link
Owner

I remembered.
Currently, I put the following limitation for Manifest since https://developer.android.com/reference/android/Manifest.permission.html#GET_ACCOUNTS and https://developer.android.com/reference/android/accounts/AccountManager.html .
For 23+, we can't change the data without the same authorised apks because of security.

    <uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
    <uses-permission
        android:name="android.permission.MANAGE_ACCOUNTS"
        android:maxSdkVersion="22" />

So, this helper all can manage account only for 21-.

@KazuCocoa
Copy link
Owner

If you git clone this repository and generate release api signed the same signature with your test target, I guess you can manage account without grant permissions.

@tontongg
Copy link
Author

Okay, I understand :) you should update the REAMDE to display this limitation to API lvl 22.
Thank you for taking time to answer me.

@KazuCocoa
Copy link
Owner

Yes, thanks and take a look at this helper!
I'll update it in a few days.

@tqk2811
Copy link

tqk2811 commented Feb 21, 2021

Can root permision work?

@KazuCocoa
Copy link
Owner

I don't know since I haven't tried rooted devices.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants