Android Account Manager not detecting package type

471 Views Asked by At

I have an Android SDK and I want to use Account Manager to centralise my accounts. The SDK will create an account if the device is registered the first time, if not, it will reuse the same account from the Account Manager.

Issue: If I install 2 apps from my own PC. I can see that the first account is created and is reused by the second app. However, when I install 2 apps from different PC's. The second app is not able to detect the account created by the first app and throws an error java.lang.SecurityException: uid 10413 cannot explicitly add accounts of type: com.example

In the second scenario, I can see other accounts on the device like Google, Skype, and Whatsapp which are ofcourse not installed from my PC and have a different signature as well then how come these package names and types are visible and not mine?

Resolved: I was using read contact permission but was missing write contact permission.

1

There are 1 best solutions below

1
Kuldeep Singh On

At a time only one app can register for adding account of a type.

The app that add accounts and the app that need account need to be of same signature. when you are trying from same PC, same debug signature is getting applied so you are able to access.

Or set visibility for packages of other apps that want to access the account while adding the accounts or after adding the account. see method - AccountManager.addAccountExplicitly or setAccountVisibility