我使用以下代码启动购买:
mHelper.launchPurchaseFlow(this, CoreApp.SKU_CHAPTER2, 10001, mPurchaseFinishedListener, "");
然后我有mPurchaseFinishedListener:
mPurchaseFinishedListener= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase)
{
Log.d("Finish Purchase","Started");
if (result.isFailure()) {
Log.d("Finish Purchase","Failure "+result.getMessage());
return;
}
if (purchase.getSku().equals(CoreApp.SKU_CHAPTER2)) {
CoreApp.in_app_chapter_2 = true;
}
}
但是在购买之后,mPurchaseFinishedListener没有被执行,即使我得到对话框Payment Successful,我知道它因为行CoreApp.in_app_chapter_2 = true
没有被执行。为什么没有执行监听器mPurchaseFinishedListener?