gpt4 book ai didi

android - 与应用程序安装关联的帐户信息

转载 作者:IT老高 更新时间:2023-10-28 21:53:07 26 4
gpt4 key购买 nike

如何处理多个帐户是在 Android 中实现应用内计费的人们普遍关注的问题。如果用户配置了多个帐户,哪一个将用于应用内计费(因为没有让用户选择帐户的选项)?挖了很多之后,下面一段here似乎可以解释它..

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.

我使用与应用计费相关的帐户创建开发者有效负载,以便以后可以在某个时间点或在其他设备上正确恢复。但是自从Honeycomb之后,就没有Primary Account这种东西了。用户可以删除任何帐户,可能是购买应用程序的帐户,在这种情况下,帐户列表中的第一个帐户将用于计费。现在,如果我知道使用了哪个帐户并且它恰好是“不是安装应用程序的帐户”,我至少可以通知用户以后不会恢复以下购买。

所以,我的问题是..

有没有办法找到用于下载应用程序的帐户?

Google Play 似乎确实使用了这些信息。无论如何,我们可以与 Google Play 交互到这个级别?

注意:PackageManager 似乎没有处理这个问题。

最佳答案

如果您想获取当前配置为播放商店帐户的帐户邮件ID的名称。请使用它。我在这里仅用于电子邮件名称,但您可以从帐户对象中获取帐户的所有信息,例如类型,描述

  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;

}
}

关于android - 与应用程序安装关联的帐户信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19275246/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com