- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我已经在我的应用中实现了应用内计费 - 最近 google 对其进行了更新,之前我正在使用 "android.test.purchased"
测试应用内计费并且它正在工作很好(购买完整版并恢复完整版)。
现在我从这里学习了改变的类(class) https://code.google.com/p/marketbilling/source/detail?r=7bc191a004483a1034b758e1df0bda062088d840
之后我无法测试应用程序,它在 Logcat “IabHelper:应用内计费错误:Sku android.test.purchased 的购买签名验证失败”中给出以下错误
"。
我已经检查了我的 key 、包名和应用程序版本都正确,有人遇到过这个问题吗?
请帮帮我。
最佳答案
这是因为 Security 类中的 verifyPurchase() 方法已在新修复中进行了更改。让我告诉你确切的问题是什么:
安全类更改
旧代码
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (signedData == null) {
Log.e(TAG, "data is null");
return false;
}
boolean verified = false;
if (!TextUtils.isEmpty(signature)) {
PublicKey key = Security.generatePublicKey(base64PublicKey);
verified = Security.verify(key, signedData, signature);
if (!verified) {
Log.w(TAG, "signature does not match data.");
return false;
}
}
return true;
}
新代码
public static boolean verifyPurchase(String base64PublicKey,
String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
|| TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
}
根据我从新代码中搜索和测试的内容,
为什么会发生,因为我们在使用像“android.test.purchased”这样的虚拟产品时不会得到任何签名。所以在旧代码中它工作得很好,因为即使没有给出签名,我们也会返回 true,而对于新代码,我们会返回 false。
更多关于签名数据 null 或空白的信息来自 link1和 link2
所以我建议你只替换旧的代码方法 verifyPurchase() 而不是 New Code 方法。
我认为新代码可能适用于真实产品,但不适用于虚拟产品。但是我还没有测试过真正的产品。
让我详细搜索一下,他们为什么更改代码以及背后的目的是什么。
编辑:
BuildConfig.DEBUG 还将为您提供测试购买的解决方案。
在 verifyPurchase 中,我将 return false
更改为:
Log.e(TAG, "Purchase verification failed: missing data.");
if (BuildConfig.DEBUG) {
return true;
}
return false;
但您应该注意仅在测试场景中使用它。
如果您有调试版本,并且签名数据丢失,这将返回 true。由于 BuildConfig.DEBUG 在生产构建中将是错误的,这应该没问题。但最好是在调试完所有内容后删除此代码。
我在 verifyPurchase() 方法中编辑了一些代码,请在下面查看:
public static boolean verifyPurchase(String base64PublicKey,
String signedData, String signature) {
if (signedData == null) {
Log.e(TAG, "data is null");
return false;
}
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
|| TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
if (BuildConfig.DEBUG) {
Log.d("DeBUG", ">>>"+BuildConfig.DEBUG);
return true;
}
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
}
我从 GvS 的回答中得到这个
android in app billing purchase verification failed .
希望对你有帮助。
关于android - 更新后应用内计费不起作用 - Google 商店,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19534210/
今天早上,我收到以下消息“此帐户位于已弃用的计费系统上。请联系支持人员将其移至新系统。”当我在门户中打开订阅 Blade 时。当我尝试提交计费支持票证时,它只是在尝试提出支持计划时挂起,无论如何,这对
我正在尝试按照此 firebase 教程设置系统以在超出配额时禁用计费。 https://www.youtube.com/watch?v=Dk3VvRSrQIY 视频描述中链接的文档建议可以延迟终止开
Azure 中是否有办法根据资源组成员身份获取 2 个(或更多)在同一订阅下创建的资源消耗的单独发票?示例: 资源组 A - 包含 Sql 数据库 - 1 张发票 资源组 B - 具有应用服务 - 第
美好的一天。 我是 Azure 云新手,正在尝试了解不同的服务。 我们有 FileShare 存储帐户,该帐户安装在创建的 VM 上。存储帐户是否会默认启用 Azure Defender?我问这个问题
美好的一天。 我是 Azure 云新手,正在尝试了解不同的服务。 我们有 FileShare 存储帐户,该帐户安装在创建的 VM 上。存储帐户是否会默认启用 Azure Defender?我问这个问题
我正在尝试购买测试项目 ID“android.test.purchased”,以检查我的账单集成。但是出现如下错误: com.android.vending.api.ApiException: Err
我有一个带有应用内结算功能的安卓应用。我想要订阅。我看到一个谷歌示例。我在我的申请中介绍了计费。我购买一件商品。但我有问题。我单击按钮“购买”开始 Intent ...。关闭此 Intent 后(文本
默认情况下有多少个前端池附带 ASEv2? 前端池是否包含在 ASEv2 固定月费中?是否根据 worker 的数量和级别(I1、I2、I、3)收费?即 1x I1 前端 + 1x I1 工作人员 =
我们最近开始了新的 Azure DevOps 环境之旅。我确实需要 Microsoft 托管代理和即用即付并行作业的详细计费文档。Microsoft 托管代理相对于自托管代理有哪些优势以及这一切的成本
我们最近开始了新的 Azure DevOps 环境之旅。我确实需要 Microsoft 托管代理和即用即付并行作业的详细计费文档。Microsoft 托管代理相对于自托管代理有哪些优势以及这一切的成本
我正在制作一个应用程序,它可以存储用户使用我的应用程序学习了多少分钟。我的 Firestore 数据库以“用户”集合开头,每个用户都有自己的文档,该文档由 Auth 中生成的用户 ID 命名。 我的问
我需要与 Windows Azure 服务总线主题计费相关的详细信息。例如。 我需要为我的应用程序发布的内容或我的应用程序接收的内容付费吗? 例如。假设我有 1 个出版商和 5 个主题。每个主题每秒有
我正在使用 Azure 发票 API,它要求提供以下参数 https://management.azure.com/providers/Microsoft.Billing/billingAccount
在 Azure 的付款估算器上,我可以选择希望应用服务处于事件状态/付费的小时数。由于在办公时间之外或周末不需要我的应用程序,因此我可以减少工作时间,因此与支付 24/7 相比,成本估算会大大减少。因
我正在尝试对 SQL Azure 的计费术语进行一些澄清...我们目前有一个内部 SQL Server (2008),我们可以从中运行多个数据库。 SQL Azure 计费文档根据数据库大小列出了价格
知道 Azure 计费 API 是否依赖于部署模型(RM 或经典?)。这 Azure documentation没有提及任何具体内容。 最佳答案 两者都不是。部署模型与您配置的 Azure资源相关。计
我想在 Azure DevOps 组织超过一定阈值后删除其计费,以免他们被多收费。所以我有两个问题。首先,是否可以通过 Azure 门户上的成本管理/计费来确定特定 Azure DevOps 组织的预
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: This version of the application is not configured for
我正在尝试在我的一个应用程序中将诺基亚集成到应用程序购买中。我能够在诺基亚 X 模拟器上运行它。但是当我尝试在诺基亚 X 设备上执行相同的代码时,我遇到了以下问题。 我尝试为诺基亚商店应用清除数据,但
我正在开发一个 android 项目,我正在尝试实现 In App Billing V3。 我已将我的应用上传到 Google Play,并向该应用添加 IAP。我可以成功检索我的应用程序具有的 IA
我是一名优秀的程序员,十分优秀!