In app billing on Android shows error : 1003 : Purchase signature verification failed

In app billing on Android shows error : 1003 : Purchase signature verification failed

我正在尝试验证产品是否是从商店购买的。

为此,我使用了以下代码:

mHelper.queryInventoryAsync(mGotInventoryListener);

回调如下:

IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
        Log.d(TAG, "Query inventory finished.");

        // Have we been disposed of in the meantime? If so, quit.
        if (mHelper == null) return;

        // Is it a failure?
        **if (result.isFailure()) { // This fails in our case**
            complain("Failed to query inventory: " + result);
            return;
        }

    }
};

但每次我都遇到与下面所附屏幕所示相同的错误。

我尝试了以下提到的步骤,但未能成功。

任何人都可以提出相同的建议。如果我需要添加一些东西来解决这个问题,请告诉我?

您是要购买 android.test.purchased 还是其他商品?如果您使用的是 android.test.purchased,请查看此答案,它应该可以回答您的问题:Android in app purchase: Signature verification failed

找到解决方案:)

注册广播接收器时出现问题。

请在下面找到 startSetup 方法的代码,该方法正在注册以下代码段中缺少的广播接收器。

mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {   public void onIabSetupFinished(IabResult result) {
  if (!result.isSuccess()) {
     // Oh noes, there was a problem.
     Log.d(TAG, "Problem setting up In-app Billing: " + result);
  }  mBroadcastReceiver = new IabBroadcastReceiver(MainActivity.this);
            IntentFilter broadcastFilter = new IntentFilter(IabBroadcastReceiver.ACTION);
            registerReceiver(mBroadcastReceiver, broadcastFilter);
     // Hooray, IAB is fully set up!   }});