如何获取非主要购买帐户电子邮件地址
在推出 Android 3.0 之前,在手机上注册的第一个 com.google
帐户是主帐户,也是 Android Market 使用的唯一帐户。
在 Android 3.0 及更高版本的设备上,我不能再依赖此 (Account[0]
) 来获取客户的电子邮件地址。
有没有办法知道哪个帐户 com.google
帐户当前正在进行购买?
(我需要的只是帐户类型 com.google
的 Account[]
数组中的索引。一旦我有了相关索引)
Prior to the introduction of Android 3.0, the first com.google
account registered on a phone was the primary account, and the only account used by Android Market.
On devices on Android 3.0 and up I can no longer rely on this (Account[0]
) to get the customer's email address.
Is there a way to tell which account com.google
account is currently making the purchase?
(all I need is the index into the Account[]
array for account type com.google
. I can get the email address once I have the relevant index)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
恐怕这是不可能的。根据我的发现,进行应用内购买的帐户似乎是用于安装应用程序的帐户,而您不知道这一点。我想可能可以从 root 手机上的 Play 商店应用程序数据库中读取它。
看起来使用 Google Play Android Developer API,但不知道为什么会这样。
如果你万一发现了这一点,请告诉我。
I am afraid it's not possible. From what I've found it looks like that the account making the in-app-purchase is the account used to install the app, which you don't know. I guess it might be possible to read it from the Play store application database on rooted phones.
It looks like that it's not even possible to find the purchasing account after the purchase has been done using the Google Play Android Developer API, not sure why is that though.
If you, by any chance, find that out, let me know.
我刚刚做了一个快速的谷歌搜索,并在这个网站上发现了这个
您可以使用
AccountManager.getAccounts
或AccountManager.getAccountsByType
获取设备上所有帐户名称的列表。幸运的是,对于某些帐户类型(包括com.google
),帐户名称是电子邮件地址。下面的示例片段。请注意,这需要
GET_ACCOUNTS
权限:有关使用
AccountManager
的更多信息,请访问 联系人管理器 SDK 中的示例代码。I just did a quick google search and came across this on this site here.
You can use
AccountManager.getAccounts
orAccountManager.getAccountsByType
to get a list of all account names on the device. Fortunately, for certain account types (includingcom.google
), the account names are email addresses. Example snippet below.Note that this requires the
GET_ACCOUNTS
permission:More on using
AccountManager
can be found at the Contact Manager sample code in the SDK.名字和姓氏 >> java代码?
电子邮件添加代码
firs name and last name >> java code ?
email add code