具有多个帐户的Android应用内购买 [英] Android in-app purchases with multiple accounts

查看:45
本文介绍了具有多个帐户的Android应用内购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向我的应用添加应用内购买,此功能正在运行.我有一台上面有两个帐户的设备.一个是我的主要帐户(用于发布应用程序),另一个是我的开发帐户,用于测试购买.

I am adding in-app purchases to my app, which is working. I have a device that has two accounts on it. One is my primary account--which I use to publish apps--and the other is a dev account that I use to test purchases.

在用户可以购买之前,他们必须使用自己的Google凭据登录:

Before the user can purchase, they are required to sign in using their google credentials:

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
    .requestEmail()
    .build();

mGoogleApiClient = new GoogleApiClient.Builder(mainActivity)
    .enableAutoManage(mainActivity, this)
    .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
    .build();

Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
mainActivity.startActivityForResult(signInIntent, RC_SIGN_IN);

此时,我选择我的开发者帐户

At this point, I choose my dev account

即使我选择了开发者帐户,当我尝试进行购买时,它似乎使用了我的主帐户,并且不允许我进行购买.

Even though I choose my dev account, when I attempt to make a purchase, it appears to use my primary account and does not allow me to make a purchase.

我无法确定在进行应用内购买时指定要使用哪个Google帐户的方法.

I cannot determine a way to specify which Google account is to be used when making an in-app purchase.

我主要担心的是,如果用户在其设备上拥有多个帐户,我的应用程序是否会在错误的帐户上进行购买?

My main concern is that if a user has multiple accounts on their device, will my app make a purchase on the wrong account?

任何人都可以对此提供任何见识吗?

Can anyone provide any insight on this?

注意:如果我使用开发人员帐户登录设备并登录应用程序,则只能选择我的开发人员Google帐户.这样做可以使应用程序内购买完美地工作.

Note: If I sign in to my device using the Dev account and I sign in to the app, I am only given the option to choose my Dev Google account. Doing this makes in-app purchases work perfectly.

推荐答案

应用内购买帐户与已登录帐户无关,它与在设备上安装了该应用程序的用户有关.强制使用其他用户的最佳方法是从设备上卸载该应用,然后从您的PC上的网络版本在Google Play 上重新安装.确保您使用正确的帐户登录并安装该应用.应用内购买将使用该帐户进行.

The in-app purchases account is not related to the signed in account, it's related to the user that installed the app on the device. The best way to force a different user is by uninstalling the app from the device and then re-install it from the web version of google play on your PC. Make sure you're signed in with the correct account there and install the app. In-app purchases will be made with that account.

这篇关于具有多个帐户的Android应用内购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆