Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

android - Google Play In-App Purchase returns error code -1008: null puchaseData or dataSignature

I am attempting to implement Google Play in-app purchase v3, after successfully implementing it in v2. However, every single time I attempt to purchase one of my real in-app products, I receive the following follow-up error:

IAB returned null purchaseData or dataSignature (response -1008:Unknown error)

This is coming from the IabHelper.java class, line 452:

if (purchaseData == null || dataSignature == null) {
    logError("BUG: either purchaseData or dataSignature is null.");
    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;
}

I have verified that a) my app is signed, b) the version of my app matches the draft version # on the Google Play store, and c) the user attempting the purchase has been added as a test user. I have tried this across 3 test accounts and 4 in-app purchase subscription types.

  • Should I be concerned about this error code?
  • Is this an issue confined only to non-production releases?
  • Will this affect my customers in the field if/when I release this version?
  • Can you really only test in-app purchase end-to-end once you actually published it live with IAB version 3? I realize I can use the android.test.purchased item type, and I have (it works), but I don't consider that a valid end-to-end test.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...