我一直在尝试为我的第一个应用设置应用内计费,并且一直在使用 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!");
}
}
};