I have successfully added in app purchases to my app, and it goes through fine:
but the if (purchase.getSku().equals("android.test.purchased"))
doesn't go through, and so I can't update my UI with the premium version!
public void buy(View v) {
mHelper.launchPurchaseFlow(this, "android.test.purchased", 10001,
mPurchaseFinishedListener, "developerPayLoadString");
}
IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener
= new IabHelper.OnIabPurchaseFinishedListener() {
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
if (result.isFailure()) {
Toast.makeText(MainActivity.this, "Unable to make purchase.", Toast.LENGTH_SHORT).show();
return;
} else if (purchase.getSku().equals("android.test.purchased")) {
Toast.makeText(MainActivity.this, "Successfully bought product!", Toast.LENGTH_SHORT).show();
}
};
Why isn't the if (purchase.getSku().equals("android.test.purchased"))
going through even though the payment is successful?
Thanks,
Ruchir