我正在为Android Cordova应用程序使用Fovea.cc购买插件。插件已初始化,但找不到我的应用内购买产品-如果产品不存在或应用未发布,则会出现相同的“找不到产品”错误。我正在寻找更多的故障排除步骤。
这是相关的代码,在应用启动时会被调用:
store.register({
id: "com.ineptech.wn.unlockgame",
alias: "unlockgame",
type: store.NON_CONSUMABLE
});
store.ready(function() {
console.log("\\o/ STORE READY \\o/"); // This does get called
});
store.when("unlockgame").approved(function (order) {
UnlockContent();
order.finish();
});
store.refresh();
var p = store.get("unlockgame");
popup("Title = " + p.title);
// this displays "Title = null"
这是购买按钮的代码:
store.order("unlockgame");
// Results in "The item you were attempting to purchase
// could not be found" error from Play Store
以下是采购尝试在logcat中显示的内容:
I/ActivityManager(424): Displayed com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity: +80ms
E/Volley(22062): [1009] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/preparePurchase
这是我已经仔细检查过的内容:
还有什么可能使插件无法获得产品?
问题很可能与您的配置有关,但首先我看到的是您在执行store.refresh()之后立即尝试访问产品标题
store.refresh();
var p = store.get("unlockgame");
但是,store.refresh()
方法是异步的,只会触发对服务器的请求。您可以通过以下方式监视对产品的更改:
store.when("unlockgame").updated(function(p) {
alert("product is " + p.state + ", title is " + p.title);
});
然后致电:
store.refresh();
还要检查Play控制台上的产品ID是否为com.ineptech.wn.unlockgame
,而不仅仅是unlockgame
,并且类型是否为Managed
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句