1

Background

I wish to get the account details of the user (just the email) that was used in order to download the app from the play store.

The reason is very simple: In-App-Billing allows to add something that is called "developer payload" (described on this google IO lecture) to purchases, so that it will verify that the purchase is legit, because it has a tag that identifies the purchase with the current user.

I think other people can think of other reasons to get it. maybe for saving games progress , for example.

The problem

Currently, All I know that you can do is to get ALL of the accounts (using the AccountManager as shown here) .

However, I'm not sure if that's the best thing to do.

The question

How do I achieve such a thing?

Also, is getting the list of all of the accounts also a good thing for this purpose (in app billing verification) ? Is it even a good thing to put the account info into the developer-payload of the purchase?

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • check this link: http://stackoverflow.com/questions/16958535/get-email-id-of-device-which-is-configured-with-playstore I haven't tried yet but it seems helpful to you. you can also use random string as a developer payload check this link: http://stackoverflow.com/questions/17196562/token-that-identify-the-user/17205999#17205999 – Maulik Nov 06 '13 at 13:57
  • well as i've said i already know how to get all of the accounts. i want to know which one was used to download the current app. about the random strings , how would you recover them when the user has installed the app on another device (or uninstalled&re-installed it) ? using the backupManager ? – android developer Nov 06 '13 at 20:30
  • I think that it's possible to store and restore the developer-payload by using SharedPreferencesBackupHelper : http://developer.android.com/reference/android/app/backup/SharedPreferencesBackupHelper.html , http://stackoverflow.com/questions/5161530/android-sharedpreferences-backup-not-working – android developer Nov 14 '13 at 00:13
  • @AndroidDeveloper, have you solved your problem? Please share the solution. Thanks – sberezin May 19 '15 at 11:37
  • @sberezin Not using the method I wanted. Instead, I've put all of the accounts data into the mix, and when needed to verify, I've checked this data vs all the accounts the user currently have. However, maybe I can assume that the first account is always the one that was used for downloading the app. – android developer May 19 '15 at 16:11
  • @AndroidDeveloper, thanks. But now Google Play allows to choose an account before downloading and when you do in-app purchase it uses the same one. But you can't see it from within the app (at least it seems so)... – sberezin May 19 '15 at 19:49
  • @sberezin I see. That's probably why I asked this question. So use what I did instead. – android developer May 19 '15 at 21:39

0 Answers0