The new Android Billing v3 documentation and helper code uses startIntentSenderForResult()
when launching a purchase flow. I want to start a purchase flow (and receive the result) from a Fragment
.
For example the documentation suggests calling
startIntentSenderForResult(pendingIntent.getIntentSender(),
1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
Integer.valueOf(0));
and the helper code calls
mHelper.launchPurchaseFlow(this, SKU_GAS, 10001,
mPurchaseFinishedListener, "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ");
which calls startIntentSenderForResult()
.
The problem is, calling startIntentSenderForResult()
causes onActivityResult()
to be called on the parent Activity
rather than on the Fragment
that it was called from (where the IabHelper
resides).
I could receive the onActivityResult()
in the parent Activity
and then manually call the onActivityResult()
on the Fragment
, but is there a way to make a call to startIntentSenderForResult()
from a Fragment
that returns the result directly to that Fragment
's onActivityResult()
?