android - 签名验证失败 - Android 应用内购买

标签 android in-app-purchase

我已经在 Android 应用程序上实现了应用计费,虽然它在测试常量下工作正常,但它在实际产品上出现问题。

我已将应用程序作为草稿上传到 Google Play,创建并发布了产品,在设备上安装了完全相同的应用程序(包括正确的 base64EncodedPublicKey)并使用了正确的测试帐户(设备上的主帐户和另一个我确实在我的开发者帐户上设置了)

流程是我进入 Google Play Activity ,在那里我可以看到产品及其详细信息,我按下购买,输入测试帐户密码,它退出 Activity ,收到祝贺信息和

Signature verification failed for product(response:-1003:Purchase signature verification failed)

该商品实际已购买(它出现在 Google Checkout 上,并且在第二次尝试购买时显示“该商品已拥有”)。此外,我仅使用了 Google 的 TriviaDrive 示例代码。

任何建议都非常有帮助。谢谢!

最佳答案

在 In App Billing 文档中有一个名为 Initiate your connection to Google Play 的部分.

它告诉您需要一个 base64 编码的公钥来实例化您的 IabHelper。您可以从 Google Play 开发者控制台获取此代码。登录到控制台,单击应用程序,然后转到“服务和 API”选项卡。

IabHelper mHelper;

@Override
public void onCreate(Bundle savedInstanceState) {
   // ...
   String base64EncodedPublicKey;

   // compute your public key and store it in base64EncodedPublicKey
   mHelper = new IabHelper(this, base64EncodedPublicKey);
}

请考虑文档中建议的安全建议:

Security Recommendation: It is highly recommended that you do not hard-code the exact public license key string value as provided by Google Play. Instead, you can construct the whole public license key string at runtime from substrings, or retrieve it from an encrypted store, before passing it to the constructor. This approach makes it more difficult for malicious third-parties to modify the public license key string in your APK file.

关于android - 签名验证失败 - Android 应用内购买,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15409833/

相关文章:

更新后 android.support 库不兼容

java - RelativeLayout 在 vi​​ew.setVisibility(View.GONE) 和 view.setVisibility(View.VISIBLE) 之后刷新

java - 使用 Picasso 将图像加载到位图中

xcode - 将我的硬币变量传递给另一个场景

ios - 即使用户重新安装后也限制 iOS 应用程序

android - 使用 ViewPropertyAnimator 和 scaleY 时如何将 View 锚定到顶部?

java - DialogFragment 无法使用 1 个按钮。

iphone - 在应用程序内购买积分以在外部网站中使用?

iPhone + 应用内购买 + 更改提醒消息

ios - 自动续订订阅是否仅限于报亭?