From second time “In app purchase” throwing exception in Android

♀尐吖头ヾ 提交于 2019-12-04 09:39:26

Hi get to know about the solution for the prob mentioned above.To get rid of this you should clear the cache of Google play app on your android phone.When we make any in app purchase are details are maintained by the Google play services.So once the a product is purchased play Isolates the particular sku,to avoid duplicate purchase. Note - This is actually for testing purpose. Because Google play services maintains the record of all applications which have in app purchase or Oauth or any other facilities. Hope it would help some one who is facing this problem.

When we try to purchase the already owned item we will get the null exception at Pending Intent.

So you need to check whether the product is purchased or not and then initiate the purchase only if the product is not purchased.

Product purchase state can be retrieved using the function

boolean haspurchase = inventory.hasPurchase(sku_id);

It worked for me..!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!