Reputation: 2094
I am trying to verify whether product is purchased or not from store.
For that I have used the below code :
mHelper.queryInventoryAsync(mGotInventoryListener);
And call back is as mentioned below :
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;
}
}
};
But every time I am getting same error as shown in below attached screen.
I have tried with below mentioned steps but failed to get success.
Can anybody suggest for the same. Please let me know if I need to add something in order to solve this issue?
Upvotes: 2
Views: 3130
Reputation: 2094
Found the solution :)
There was an issue with registering a broadcast receiver.
Plese find below code of startSetup method which is registering broadcast receiver that was missing from the following snippet.
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! }});
Upvotes: 1
Reputation: 987
Are you trying to purchase android.test.purchased or another item? If you are using android.test.purchased, check this answer, it should answer your question: Android in app purchase: Signature verification failed
Upvotes: 1