This is part of the code to implement in-app billing. I have two doubts.
@Override
public void onPurchaseStateChange(PurchaseState purchaseState, String itemId,
int quantity, long purchaseTime, String developerPayload) {
if (Consts.DEBUG) {
Log.i(TAG, "onPurchaseStateChange() itemId: " + itemId + " " + purchaseState);
}
if (developerPayload == null) {
logProductActivity(itemId, purchaseState.toString());
} else {
logProductActivity(itemId, purchaseState + "\n\t" + developerPayload);
}
if (purchaseState == PurchaseState.PURCHASED) {
mOwnedItems.add(itemId);
// At this point I have to put Premium changes
}
}
My questions:
At the point where I say "At this point I have to put Premium changes", how can I assure you that the application has been purchased?
I have understood that once the purchase is made, this can take a few hours to take effect. How do I ensure that my application will execute the code that's in point: "At this point I have to put Premium changes"?