android - 如果没有用户登录,弹出谷歌登录页面

标签 android google-play in-app-billing

我的 Android 应用有一些用户可以进行的应用内购买,但如果应用在没有登录用户的设备上启动,billing v3 API 只会返回错误 3“BILLING_UNAVAILABLE”
在这种情况下,我的主要选择是弹出一个消息框,告诉用户去登录谷歌帐户,但这相当麻烦。
有没有办法只为用户弹出 google 登录页面?
我看到使用“游戏服务”api(成就、排行榜等)的应用程序可以做到这一点,但我的应用程序仍然无法做到这一点。

最佳答案

当您收到 BILLING_UNAVAILABLE 响应时,您可以尝试这样的操作来启动添加 Google 帐户流程:

Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] {"com.google"});
startActivity(intent);

关于android - 如果没有用户登录,弹出谷歌登录页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34436006/

相关文章:

android - 提供额外的媒体资源(图形/声音)作为 Google Play 应用内付费项目

android - 如何在 mac 上使用 adb 和 genymotion?

Android:ContentResolver 中的 Distinct 和 GroupBy

android - 是否可以抓取Google Play商店?

android - 由于 Google Play 控制台的 APK 签名过程,无法更新 Unity 游戏

带有黑色等待屏幕的 Android 应用内结算示例

android - 三星健康 SDK 合作伙伴应用程序注册

android - 将 sqlcipher 从 3.5.2 升级到 4.0.1 后,GreenDAO 无法访问现有数据库

android - 如何区分用户是否在谷歌播放订阅试用期?

android - Google Play 结算 : how to simulate 'Account Hold' status (in debug/sandbox mode)