@Override
    public boolean handleActivityResult(final int requestCode, final int resultCode, @Nullable final Intent data) {
        Logger.i("NokiaStoreHelper.handleActivityResult");

        if (requestCode != mRequestCode) {
            return false;
        }

        IabResult result;

        if (data == null) {
            Logger.e("Null data in IAB activity result.");
            result = new NokiaResult(IabHelper.IABHELPER_BAD_RESPONSE, "Null data in IAB result");

            if (mPurchaseListener != null) {
                mPurchaseListener.onIabPurchaseFinished(result, null);
            }

            return true;
        }

        final int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
        final String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");

        Logger.d("responseCode = ", responseCode);
        Logger.d("purchaseData = ", purchaseData);

        if (resultCode == Activity.RESULT_OK && responseCode == RESULT_OK) {

            processPurchaseSuccess(purchaseData);

        } else if (resultCode == Activity.RESULT_OK) {

            processPurchaseFail(responseCode);

        } else if (resultCode == Activity.RESULT_CANCELED) {

            Logger.d("Purchase canceled - Response: ", responseCode);

            result = new NokiaResult(IabHelper.IABHELPER_USER_CANCELLED, "User canceled.");

            if (mPurchaseListener != null) {
                mPurchaseListener.onIabPurchaseFinished(result, null);
            }

        } else {

            Logger.e("Purchase failed. Result code: ", resultCode);

            result = new NokiaResult(IabHelper.IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");

            if (mPurchaseListener != null) {
                mPurchaseListener.onIabPurchaseFinished(result, null);
            }
        }

        return true;
    }
@ Override public boolean handleActivityResult ( final int requestCode , final int resultCode , @ Nullable final Intent data ) { Logger . i ( "NokiaStoreHelper.handleActivityResult" ) ; if ( requestCode != mRequestCode ) { return false ; } IabResult result ; if ( data == null ) { Logger . e ( "Null data in IAB activity result." ) ; result = new NokiaResult ( IabHelper . IABHELPER_BAD_RESPONSE , "Null data in IAB result" ) ; if ( mPurchaseListener != null ) { mPurchaseListener . onIabPurchaseFinished ( result , null ) ; } return true ; } final int responseCode = data . getIntExtra ( "RESPONSE_CODE" , 0 ) ; final String purchaseData = data . getStringExtra ( "INAPP_PURCHASE_DATA" ) ; Logger . d ( "responseCode = " , responseCode ) ; Logger . d ( "purchaseData = " , purchaseData ) ; if ( resultCode == Activity . RESULT_OK && responseCode == RESULT_OK ) { processPurchaseSuccess ( purchaseData ) ; } else if ( resultCode == Activity . RESULT_OK ) { processPurchaseFail ( responseCode ) ; } else if ( resultCode == Activity . RESULT_CANCELED ) { Logger . d ( "Purchase canceled - Response: " , responseCode ) ; result = new NokiaResult ( IabHelper . IABHELPER_USER_CANCELLED , "User canceled." ) ; if ( mPurchaseListener != null ) { mPurchaseListener . onIabPurchaseFinished ( result , null ) ; } } else { Logger . e ( "Purchase failed. Result code: " , resultCode ) ; result = new NokiaResult ( IabHelper . IABHELPER_UNKNOWN_PURCHASE_RESPONSE , "Unknown purchase response." ) ; if ( mPurchaseListener != null ) { mPurchaseListener . onIabPurchaseFinished ( result , null ) ; } } return true ; }
Handles an activity result that's part of the purchase flow in in-app billing. If you
are calling {@link org.onepf.oms.appstore.nokiaUtils.NokiaStoreHelper#launchPurchaseFlow}, then you must call this method from your
Activity's {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)} method. This method
MUST be called from the UI thread of the Activity.

@param requestCode The requestCode as you received it.
@param resultCode  The resultCode as you received it.
@param data        The data (Intent) as you received it.
@return Returns true if the result was related to a purchase flow and was handled;
false if the result was not related to a purchase, in which case you should
handle it normally.