In-app purchases with multiple accounts

I have a problem with app purchases / subscriptions:

If there are several accounts on the device, I can’t get the purchases that were made with the second account. Sometimes this can be temporarily fixed by installing the application from the Google Play web interface, but after a while the purchases will not appear in the request, forcing the user to reinstall.

I am using the IabHelper classes from this example .

While doing some Google searches, I found that this error exists over time, but, unfortunately, I could not find out if the error is in the IabHelper classes or on the Google side.

I would like to draw attention to Google, so they provide the correct fix for this, either in the IabHelper classes, or in the Playback Service, or to provide information on how this should be handled.

I use the code in the application with (at the time of writing) 900,000 active users, and because of this I have to cause quite a lot of refunds.

If there is a fix for this that I missed, let me know.

Edit: Sometimes it’s generally not possible to get purchases, even if there is only one account on the phone.

+54
android google-play-services google-play in-app-billing android-billing
Mar 02 '15 at 13:53 on
source share
6 answers

There seems to be no way to solve this problem, but try to do it.

  • When the user first installs the application, gets his / her primary email address or all accounts on the device

  • Ask the user what email address they will use for future payment / or which account is active for playing Google.

    you can use this code to get an account

    Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+ Account[] accounts = AccountManager.get(context).getAccounts(); for (Account account : accounts) { if (emailPattern.matcher(account.name).matches()) { String possibleEmail = account.name; ... } } 

    Do not forget to ask permission

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

    After the user selects an email address, you can send the link by email to confirm this email address

  • Keep the entire payment for this particular letter.

Method 2

Use the new "Send and receive money using Gmail" in the future

  • Create an email intent and send specific data to the email intent and complete the payments.

  • After success, email the code to the user

  • Use the code to activate what they purchased.

Method 3

Use a different payment library or gateway to purchase your application instead of Google.

+1
Nov 08 '16 at 19:58
source share

I am sure that the error in the billing service in the application.

This question is similar, and as mentioned in one of the answers, you may need to enter the login mechanism and save the purchases made from the account to your server or locally on the device in an encrypted file or something similar.

0
Nov 19 '15 at 11:19
source share

I ran into the same problem a couple of months later. After hours of finding solutions and all that I came up with is working around something like this,

You can use OAuth 2.0.

But you must also manage it from your server. I’m not a third-party developer, so I didn’t know exactly how it works in the backend, but on the application side I did something like this,

You can use the first Google account to allow authentication on your side. OAuth 2.0 is a tool that simplifies and allows developers to easily allow users access to your application. The OAuthHmacSigner class manages authentication.

 signer = new OAuthHmacSigner(); signer.clientSharedSecret = Constants.CONSUMER_SECRET; 

Android activity then uses the following code to start the OAuth stream:

 launchOauth.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent().setClass(v.getContext(), PrepareRequestTokenActivity.class)); } }); 

To get the OAuth 2.0 access token, you just need to call:

 AccountManager.getAuthToken() 

Hope this can help :)

0
Nov 21 '15 at 19:17
source share

I have two accounts, but no one works. What I did was that I went into Android settings and then took into account preferences. I changed the main account with one that does not work on the worker. Then I assigned the new account as the primary account for all my applications, including Google Play. It worked for me. Sometimes, if for some reason it doesn’t work, you can also go online and access the Google Play store from the Internet.

0
Apr 29 '16 at 2:59
source share

Try getting dup ... duplicate dot with a file signature ending in .apk or .xcode

0
Aug 11 '16 at 6:32
source share

I'm not sure if this is the answer you are looking for, but maybe create a shared family library of Google Play. It works for up to 5 users who use the same purchases (application, music, movies, etc.), if necessary.

(See: https://support.google.com/googleplay/answer/7007852?hl=en )

-one
Nov 29 '16 at 21:34
source share



All Articles