It's a widely sought issue among those who implement In-app billing in Android, that how multiple accounts are dealt with. If a user has multiple accounts configured, which one will be used for in-app billing (as there is no option to let the user select an account)? After digging a lot, following paragraph here seems to explain it..
Note: To make test purchases, the license test account must be on the user’s Android device. If the device has more than one account, the purchase will be made with the account that downloaded the app. If none of the accounts has downloaded the app, the purchase is made with the first account.Users can confirm the account that is making a purchase by expanding the purchase dialog.
I create a developer payload using the account that is involved for in app billing, so that it can be restored properly at a later point in time or on some other device. But since Honeycomb, there is no such thing as Primary Account. A user can delete any account, may be the one with which the app was purchased, in which case, the first account from list of accounts will be used for billing. Now, if i know which account was used and if it occurs to be 'not the account with which app was installed', I can at least inform the user that the following purchases will not be restored later.
So, my question is..
Is there a way to find which account was used for downloading the application?
Google Play does seem to use this information. Anyway we can interact with Google Play upto this level?
note: PackageManager doesn't seem to deal with this.
Select Start > Settings > Apps. Apps can also be found on Start . The most used apps are at the top, followed by an alphabetical list.
You can view the app download history in Google Play Store from the Installed or Library sections of the Store. The Installed section shows you all the apps currently installed on your Android device.
You can see all the apps you've ever downloaded on your Android phone by opening the "My apps & games" section in your Google Play Store. The apps you've downloaded are divided into two sections: "Installed" (all the apps currently installed on your phone) and "Library" (all the apps that aren't currently installed).
If you want to get the name of account mail id which is configured to play store account currently. Please use it . I am putting here only for email name but you can get all information of account like type , descriptin from account object
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
primaryEmailID = account.name;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With