[英]Android in-app purchase failed
I'm trying to implement in-app billing system in my application, but I cannot query the inventory to retrieve the subscriptions, because I'm getting the following error: 我正在尝试在我的应用程序中实现应用内结算系统,但是由于出现以下错误,我无法查询广告资源来检索订阅:
IabResult: Error refreshing inventory (querying owned items). (response: -1003:Purchase signature verification failed)
What have I done: 我做了什么:
The code (in activity): 代码(活动中):
private IabHelper mIabHelper;
// Init setup listener
private IabHelper.OnIabSetupFinishedListener mIabSetupListener = new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
if (result.isSuccess()) {
// Load success, now query for inventory
List<String> skus = new ArrayList();
skus.add("packagename.org.dev.subscription.monthly");
skus.add("packagename.org.dev.subscription.yearly");
mIabHelper.queryInventoryAsync(true, skus, mQueryInventoryFinishedListener);
}
}
};
// Listener to load the subscriptions
private IabHelper.QueryInventoryFinishedListener mQueryInventoryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv) {
if (result.isFailure()) {
Log.e(TAG, "Failure, check error!");
return;
}
}
};
@Override
protected void onCreate(Bundle savedState) {
super.onCreate(savedState);
mIabHelper = new IabHelper(this, PUBLIC_KEY_BASE_64);
mIabHelper.enableDebugLogging(true, "BILLING");
mIabHelper.startSetup(mIabSetupListener);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mIabHelper == null || !mIabHelper.handleActivityResult(requestCode, resultCode, data))
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mIabHelper != null) {
mIabHelper.dispose();
}
}
I copied the same APK on the device (signed) and installed it, but I'm getting the above error. 我在设备上复制了相同的APK(签名)并安装了它,但出现上述错误。 I also run the application in debug mode, same error.
我还以调试模式运行该应用程序,出现同样的错误。 I don't know what to do.
我不知道该怎么办。
I have seen here (stackoverflow) that Google APIs is caching some data. 我在这里(stackoverflow)看到Google API正在缓存某些数据。 Should I do a factory reset?
我应该恢复出厂设置吗? Or how can I clear the cached data?
或者如何清除缓存的数据?
Signature verification fails mostly if the base 64 public key for your app is not correct. 如果您的应用程序的基数为64的公共密钥不正确,则签名验证失败。 make sure you are using correct "PUBLIC_KEY_BASE_64".
确保您使用的是正确的“ PUBLIC_KEY_BASE_64”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.