所以我正在使用Android计费库并进行了一些设置:
BillingController.setConfiguration(new BillingController.IConfiguration() {
public byte[] getObfuscationSalt() {
//Havent changed this
return new byte[] { 41, -90, -116, -41, 66, -53, 122,
-110, -127, -96, -88, 77, 127, 115, 1, 73, 57,
110, 48, -116 };
}
public String getPublicKey() {
return "The key (yes this is set correctly)";
}
});
BillingController.setDebug(true);
mBillingObserver = new AbstractBillingObserver(this) {
public void onBillingChecked(boolean supported) {
BuyCoins.this.onBillingChecked(supported);
}
public void onPurchaseStateChanged(String itemId,
PurchaseState state) {
BuyCoins.this.onPurchaseStateChanged(itemId, state);
}
public void onRequestPurchaseResponse(String itemId,
ResponseCode response) {
BuyCoins.this.onRequestPurchaseResponse(itemId,
response);
}
public void onSubscriptionChecked(boolean supported) {
BuyCoins.this.onSubscriptionChecked(supported);
}
};
BillingController.registerObserver(mBillingObserver);
BillingController.checkBillingSupported(this);
BillingController.checkSubscriptionSupported(this);
}
然后简单地说:
public void onSubscriptionChecked(boolean supported) {
if (supported) {
Toast.makeText(this, "Subscription is supported", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(this, "Subscription is NOT supported", Toast.LENGTH_SHORT)
.show();
}
}
public void onRequestPurchaseResponse(String itemId, ResponseCode response) {
if (response == ResponseCode.RESULT_OK) {
Toast.makeText(this, "Purchase Response OK", Toast.LENGTH_LONG)
.show();
} else if (response == ResponseCode.RESULT_USER_CANCELED) {
Toast.makeText(this, "Purchase Response Canceled",
Toast.LENGTH_LONG).show();
} else if (response == ResponseCode.RESULT_SERVICE_UNAVAILABLE) {
Toast.makeText(this, "Purchase Response Unavailable",
Toast.LENGTH_LONG).show();
} else if (response == ResponseCode.RESULT_ERROR) {
Toast.makeText(this, "Purchase Response Error", Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(this, "UNKNOWN RESPONSE", Toast.LENGTH_LONG)
.show(); }
}
public void onPurchaseStateChanged(String itemId, PurchaseState state) {
Toast.makeText(this,
"Purchase State: " + state.toString() + " for item " + itemId,
Toast.LENGTH_LONG).show();
purchaseList();
}
public void onBillingChecked(boolean supported) {
if (supported) {
Toast.makeText(this, "Billing is supported", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(this, "Billing is NOT supported", Toast.LENGTH_SHORT)
.show();
}
}
该项目通过以下方式调用:
public void onClick(View v) {
switch (v.getId()) {
case R.id.buy_coins_button_one:
BillingController.requestPurchase(this, "coins",true /* confirm */, null);
break;
case R.id.buy_coins_button_two:
BillingController.requestPurchase(this, "android.test.purchased",true /* confirm */, null);
break;
}
}
如果我点击按钮一(硬币),我会收到标题中提到的错误(“错误处理购买:[DF-BPA-13],然后才能点击”接受并购买“
我到处检查过,似乎没有明确的答案,为什么会出现这种错误。
如果我点击按钮2(保留的安卓机器人),我可以点击购买但我得到:
从服务器检索信息时出错。 [DF-DFERH-01]
所以这里采取了一些措施来打击这种废话:
我完全迷失在这里。也许值得注意的是另一个错误([27]与1相比)[27] FileBasedKeyValueStore.delete: Attempt to delete 'paramsnMy695NrbaHSHjK0hNnMgg' failed!
我错过了什么地方吗?这一切看起来都非常简单。
我看过:
我会告诉你如何解决这个问题,因为它似乎是一个常规问题
编辑:因此您无法从开发控制台中删除应用,因此删除/添加无效。
答案 0 :(得分:1)
结帐测试帐户,发布商帐户在结帐时与同一张信用卡绑定。在测试帐户上更改它会修复它。 Grrrrr。
答案 1 :(得分:0)