我一直在尝试为我的第一个应用设置应用内结算,并且一直在使用android.test.purchased sku。购买完成了,我设法将SKU放入我的库存中,但是,正如标题所述,onIabPurchaseFinished从未被调用。
我认为这可能与该日志有关:“无法保存哪个视图具有焦点,因为焦点视图com.android.internal.policy.impl.PhoneWindow$DecorView@406743d0没有ID”。弹出窗口,就在前往Google Play之前。我不太确定那是什么意思...
发起购买:
mHelper.launchPurchaseFlow(this, sku, 10001, mPurchaseFinishedListener, "");
和听众:
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
System.out.println("Purchase Finish heard something");
if (result.isFailure()) {
Log.d(TAG, "Error purchasing: " + result);
return;
} else{
Log.d(TAG,"Success!");
}
}
};