android - Want to know the history of item purchased -
initially had implemented code 1 time purchase only.
iabhelper.oniabpurchasefinishedlistener mpurchasefinishedlistener = new iabhelper.oniabpurchasefinishedlistener() { public void oniabpurchasefinished(iabresult result, purchase purchase) { log.d(tag, "purchase finished: " + result + ", purchase: " + purchase); // if disposed of in meantime, quit. if (mhelper == null) return; if (result.isfailure()) { log.e(tag,"error purchasing: " + result); return; } if (!verifydeveloperpayload(purchase)) { log.e(tag,"error purchasing. authenticity verification failed."); return; } log.d(tag, "purchase successful."); if (purchase.getsku().equals(item_sku)) { // bought 1/4 tank of gas. consume it. log.d(tag, "purchase gas. starting gas consumption."); log.e("successful","prrrrrrr"); globalclass.savepreferences2("ispremiumuser",1,context); mhelper.consumeasync(purchase, mconsumefinishedlistener); } } }; iabhelper.onconsumefinishedlistener mconsumefinishedlistener = new iabhelper.onconsumefinishedlistener() { public void onconsumefinished(purchase purchase, iabresult result) { log.d(tag, "consumption finished. purchase: " + purchase + ", result: " + result); // if disposed of in meantime, quit. if (mhelper == null) return; // know "gas" sku because it's 1 consume, // don't check sku consumed. if have more 1 // sku, should check... if (result.issuccess()) { // consumed, apply effects of item in our // game world's logic, in our case means filling gas tank bit log.d(tag, "consumption successful. provisioning."); log.e("consume ","successful"); start_activity(); } else { log.e("purchase ","failed"+result); } log.d(tag, "end consumption flow."); } };
this works until user uninstall app. want convert 1 time purchase. have removed
iabhelper.onconsumefinishedlistener , mhelper.consumeasync(purchase, mconsumefinishedlistener);
from code. working fine future payments. want payments made before changes should not require pay after reinstalling app. possible that?
it possible create iap items required purchase once, , stored on google play's servers, thing need change not consume item user has purchased.
so scrape piece call
consumeasync...
and instead query inventory on app startup google plays servers, of iap v3 fast, purchases cached google play.
you can read more consumable , non-consumables on official site.
only problem you're gonna hit, users on behalf you've consumed item, not back, which, need implement on own server handle cases, or make them contact , manually give them codes you've implemented give feature, use-case specific choice.
Comments
Post a Comment