Reputation: 4383
I am working on in app billing of android..i follow tutorial of android and currently i am testing for test app.(android.test.purchased) I create app on google console I sign apk and upload it to google console than i copy public key and paste it into my code and sign apk again and install it on phone than i tried to buy test purchased id It display me purchased successful but in my Log value i display the purchaseddata and datasignature and i got datasignature NULL (empty)
The fun part is in handleActivityResult method there is one if condition which checks weather datasignature or purchaseddata is Null or not and in my code it does not execute if skips it ? how it is possible?
Here i pur log but in my logcat i cannot see "In BUG Null value"
if (purchaseData == null || dataSignature == null) {
logError("BUG: either purchaseData or dataSignature is null.");
Log.e("Inapp", "In BUG Null value");
logDebug("Extras: " + data.getExtras().toString());
result = new IabResult(IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData or dataSignature");
if (mPurchaseListener != null) mPurchaseListener.onIabPurchaseFinished(result, null);
return true;
}
Upvotes: 2
Views: 1157
Reputation: 69
I had this problem myself. After a while I found what I did wrong. I was calling the wrong method on the IABHelper.
If you call mHelper.launchPurchaseFlow(...) with an SKU that is registered as a subscription on Google Developer Console it will result in the error: IAB returned null purchaseData or dataSignature (response -1008:Unknown error).
If you have a SKU that is registered as an subscription you have to use the method: mHelper.launchSubscriptionPurchaseFlow(...) instead.
Hope this helps.
Upvotes: 3