Calling startIntentSenderForResult from Fragment (Android Billing v3)

前端 未结 11 1142
广开言路
广开言路 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条回答
  •  -上瘾入骨i
    2020-11-29 03:32

    From SDK 24 and above, there is a startIntentSenderForResult method available in support Fragment also, which works as intended. Note that there is an additional Bundle parameter, which can be passed as null. Thus, final code will be:

    startIntentSenderForResult(pendingIntent.getIntentSender(),
        1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
        Integer.valueOf(0), null);
    

    Of course, for API 23 and below, we will still need to use the tricks described in other answers.

提交回复
热议问题