Closed panhaozi closed 9 years ago
My environment: libgdx 1.5.6, gdx-pay 0.5.0-SNAPSHOT
Might be related to the purchase configuration you have setup. Can you post your configuration of offers/etc.?
if(PurchaseSystem.hasManager())
{
Gdx.app.log("iap", "hasManager");
PurchaseManagerConfig config = new PurchaseManagerConfig();
config.addOffer(new Offer().setIdentifier("30days_menbership").setType(OfferType.CONSUMABLE));
config.addOffer(new Offer().setIdentifier("100crystals").setType(OfferType.CONSUMABLE));
PurchaseSystem.install(new PurchaseObserver()
{
@Override
public void handleRestoreError(Throwable arg0)
{
Gdx.app.log("iap", "handleRestoreError");
}
@Override
public void handleRestore(Transaction[] arg0)
{
Gdx.app.log("iap", "handleRestore");
PurchaseSystem.purchase("100crystals");
}
@Override
public void handlePurchaseError(Throwable arg0)
{
Gdx.app.log("iap", "handlePurchaseError");
}
@Override
public void handlePurchaseCanceled()
{
Gdx.app.log("iap", "handlePurchaseCanceled");
}
@Override
public void handlePurchase(Transaction arg0)
{
Gdx.app.log("iap", "handlePurchase");
}
@Override
public void handleInstallError(Throwable arg0)
{
Gdx.app.log("iap", "handleInstallError");
}
@Override
public void handleInstall()
{
Gdx.app.log("iap", "handleInstall");
PurchaseSystem.purchaseRestore();
}
}, config);
}
else
Gdx.app.log("iap", "noManager");
This might be a problem: PurchaseSystem.purchase("100crystals") should not be in handleRestore(...). This method is called from the actual store and making a call to a purchase might pose problems.
PurchaseSystem.purchaseRestore(): this should not go into handleInstall(). This method will ask for a username/password for some stores and cause problems.
Yeah, you were right.Thax
The crach log is below: I guess a NPE is thrown.