【发布时间】:2016-06-22 11:17:07
【问题描述】:
我编写了一个 IAB(应用内计费)应用程序。高级购买将提交到谷歌仪表板,我也可以看到该项目的发票,用户不能两次购买该项目。所以没关系。
但是通过使用下面的代码,我无法理解用户是否是高级用户,因为 premiumPurchase 始终是 null。 (我在设置完成的侦听器中调用此方法)
mHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (mHelper == null) return;
if (result.isFailure()) {
return;
}
Purchase premiumPurchase = inventory.getPurchase(SKU_PREMUIM);
if(premiumPurchase!=null) {
//Toast.makeText(getApplicationContext(),"permuim",Toast.LENGTH_SHORT).show();
lblIsPremuim.setText("You are Premium");
}
else{
lblIsPremuim.setText("You are Not Premium");
Toast.makeText(getApplicationContext(),"not permuim",Toast.LENGTH_SHORT).show();
}
}
});
我已重新启动设备并清除了 Google Play 的缓存,并且我确定我已使用正确的帐户登录。 base-64 公钥肯定是正确的,我已经阅读了 Stack-Over-Flow 中的所有帖子,这些帖子都提到了这个问题,但没有找到解决方案。我正在使用与上传的应用相同的版本名称和版本代码以及相同的密钥库。
【问题讨论】:
标签: java android in-app-billing