【问题标题】:In-App purchase fetching buyer email after purchasing购买后应用内购买获取买家电子邮件
【发布时间】:2014-11-25 22:46:56
【问题描述】:

使用谷歌钱包购买后有没有办法获取买家的邮箱,

我使用的是IabHelper.launchSubscriptionPurchaseFlow,购买(Subscription)成功后只检索到两个对象(IabResult和Purchase),可惜没有一个包含买家的email。

场景是,如果用户有多个电子邮件连接到他的 Android 设备,并且他有一张信用卡连接到他的辅助电子邮件之一,我需要获取用于购买的电子邮件地址才能使用它在服务器端。

我希望在这个问题上找到帮助我的人,因为我花了很多时间搜索这个问题,不幸的是我没有找到解决方案。

最好的问候

【问题讨论】:

  • :下面这个答案对你有帮助吗???
  • @Mohammad AL-Hashaike,您找到任何解决方案或解决方法了吗?

标签: android email in-app-purchase android-pay


【解决方案1】:

我认为在成功的购买响应中您无法存储买家的电子邮件。

因此,您可以使用 AccountManager 类在 onIabPurchaseFinished 中调用以下方法。

public static String getemailId(Activity act){
        Pattern emailPattern = Patterns.EMAIL_ADDRESS;
        Account[] accounts= AccountManager.get(act).getAccounts();
        String userEmailId="";
        for (Account account : accounts) {
            if (emailPattern.matcher(account.name).matches()) {
                userEmailId = account.name;

            }
        }
        return userEmailId;
}

此方法将返回买家的 email_id 以供将来使用。

希望对你有很大帮助。

【讨论】:

  • 这不是解决方案。它可以提供设备上的所有电子邮件 ID,但无法判断是哪个 ID 用于购买。
猜你喜欢
  • 2022-01-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-29
  • 2011-12-14
相关资源
最近更新 更多