Calling startIntentSenderForResult from Fragment (Android Billing v3)

前端 未结 11 1182
广开言路
广开言路 2020-11-29 02:46

The new Android Billing v3 documentation and helper code uses startIntentSenderForResult() when launching a purchase flow. I want to start a purchase flow (and

11条回答
  •  感动是毒
    2020-11-29 03:32

    1) You should modify your resultCode (RC_REQUEST) to put fragment index to it.

    int rc_reqest = RC_REQUEST +  ((getActivity().getSupportFragmentManager().getFragments().indexOf(this)+1)<<16)  ;      
    mHelper.launchPurchaseFlow(getActivity(), sku, rc_reqest ,mPurchaseFinishedListener, payload);
    

    2) in IabHelper.launchPurchaseFlow(...)

    change mRequestCode = requestCode
    

    to

    mRequestCode = requestCode&0xffff;
    

提交回复
热议问题