Calling startIntentSenderForResult from Fragment (Android Billing v3)

前端 未结 11 1181
广开言路
广开言路 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:07

    In my case i did onActivityResult in Activity :

    @Override protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
            // not handled, so handle it ourselves (here's where you'd
            // perform any handling of activity results not related to in-app
            // billing...
            super.onActivityResult(requestCode, resultCode, data);
    
    
        }
        else {
            Log.d(TAG, "onActivityResult handled by IABUtil.");
        }
    
    }
    

    and same in fragment and it makes in app billing works

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
    
        // Pass on the activity result to the helper for handling
        if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
            // not handled, so handle it ourselves (here's where you'd
            // perform any handling of activity results not related to in-app
            // billing...
            super.onActivityResult(requestCode, resultCode, data);
    
    
        }
        else {
            Log.d(ITEM_SKU, "onActivityResult handled by IABUtil.");
        }
    
    }
    

提交回复
热议问题