Android 在 InApp 购买中出现此错误代码 3 的可能性有哪些?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21091353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are the possibilities to get this error code 3 in InApp purchase?
提问by RajaReddy PolamReddy
I am using InApp V3 code for in-app purchases in my application , i am getting this error BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
and error value :3
when Google account is not available in device. I want to know is there any other possibilities to get this error, because when i get this error i need show a popup to the user with some data. If this is causing because of Google account not available on device i will show the dialog with related text. this is the code i am using
我在我的应用程序中使用 InApp V3 代码进行应用内购买,我收到此错误BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
并且error value :3
当设备中没有 Google 帐户时。我想知道是否还有其他可能导致此错误,因为当我收到此错误时,我需要向用户显示一个包含一些数据的弹出窗口。如果这是由于设备上的 Google 帐户不可用而导致的,我将显示带有相关文本的对话框。这是我正在使用的代码
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// error here
return;
}
}
});
this is the error Error checking for billing v3 support. (response: 3:Billing Unavailable)
这是错误 Error checking for billing v3 support. (response: 3:Billing Unavailable)
回答by Carlos Robles
As we can see directly in the code of the setupof the IabHElper of the sample provided by google, the error means:
在google提供的sample的IabHElper的设置代码中我们可以直接看到,错误的意思是:
"Billing service unavailable on device."
“设备上的计费服务不可用。”
As you can read herethat error means
正如您在此处阅读的那样,错误意味着
Billing API version is not supported for the type requested
This is the In-app Billing Reference (IAB Version 3), so the error means that the IAB v3 is not installed on the device.
这是 In-app Billing Reference(IAB 版本 3),因此该错误表示设备上未安装 IAB v3。
Actually this means that the user has a google account, and probably also an in-app billing service, but it doesnt has the last version. This happens in old devices, and where the user never update anything, it uses to be devices where you can see the old Market app instead of the Play app.
实际上这意味着用户有一个 google 帐户,并且可能还有一个应用内计费服务,但它没有最新版本。这发生在旧设备中,用户从不更新任何内容,它曾经是您可以看到旧市场应用程序而不是 Play 应用程序的设备。
So the error you have to show to the user, and the test that you have to perform is not if the device has a google acount, but if it has the google play services installed and properly updated.
因此,您必须向用户显示的错误以及您必须执行的测试不是设备是否具有 google 帐户,而是是否已安装并正确更新了 google play 服务。
UPDATE:
更新:
If you look for the code in all the library SDK, and the helper classes provided by google, the only place where we can find that exactly in the function that you are calling: the startSetup
of the IabHelper
class
如果你指望所有的库SDK的代码,谷歌提供的辅助类,唯一的地方,我们可以发现,正是在函数要调用:在startSetup
中的IabHelper
类
Intent serviceIntent = new Intent(
"com.android.vending.billing.InAppBillingService.BIND");
if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0)
.isEmpty()) {
// service available to handle that Intent
mContext.bindService(serviceIntent, mServiceConn,
Context.BIND_AUTO_CREATE);
} else {
// no service available to handle that Intent
mServiceConn=null;
if (listener != null) {
listener.onIabSetupFinished(new IabResult(
BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device."));
}
}
This means that the app couldnt connect to the service in the device, since the package manager doesnt even know it. Thats the only option that can trigger that error. And what means that it couldnt connect to the service? It means one of these:
这意味着应用程序无法连接到设备中的服务,因为包管理器甚至不知道它。那是可以触发该错误的唯一选项。什么意味着它无法连接到服务?这意味着其中之一:
- The device doesnt has the service installed.
- It has an old version, since we know that the latest versions of play store, uses the IAB v3.
- 设备没有安装服务。
- 它有一个旧版本,因为我们知道最新版本的 Play 商店使用 IAB v3。
So, your error only can mean one of this, that for you means that you have to show a mesagge to the user like "You dont have google play services installed, or you have to update it". And there is not other possibilities or getting that error.
因此,您的错误仅可能意味着其中之一,对您而言,这意味着您必须向用户显示一条消息,例如“您没有安装 google play 服务,或者您必须更新它”。并且没有其他可能性或出现该错误。
But, if you want to make it easier for the users, you can say the they need to update the Google Play App to the last version. And that will make everything works like a charm.
但是,如果您想让用户更轻松,您可以说他们需要将 Google Play 应用程序更新到最新版本。这将使一切都像一个魅力。
回答by pareshgoel
This error is also received after the user removes their google account from the device.
用户从设备中删除其 google 帐户后也会收到此错误。
回答by Babken Vardanyan
Sign in to the Play Store with any account.
使用任何帐户登录 Play 商店。
After signing in billing works even on Android Studio Emulator.
登录后,即使在 Android Studio 模拟器上也能正常工作。
回答by N Sharma
Majorly possibility of your issue BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
is that In some countries still In App Purchase is not allowed like Serbia and many countries.
您的问题的BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
主要可能性是在某些国家/地区仍然不允许在应用程序内购买,例如塞尔维亚和许多国家/地区。
So Any user from the country where Google Play does not support In App Purchase then You will get BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
.
因此,来自 Google Play 不支持 In App Purchase 的国家/地区的任何用户都将获得BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE
.
This would be less chance that user do not have updated Google Play Service installed on the phone so do not worry about this case.
这将减少用户没有在手机上安装更新的 Google Play 服务的可能性,所以不要担心这种情况。
回答by LOG_TAG
Try this hacks
试试这个技巧
Remove the cache, data and updates for the play app, restarted the play app again it should work! or try with latest updates (if it is fixed)
删除播放应用程序的缓存、数据和更新,再次重新启动播放应用程序它应该可以工作了!或尝试使用最新更新(如果已修复)
FYI:
供参考:
Just keep in mind:
请记住:
IABv3 is built into Google Play services, so it requires an update to the Play Services apk.
V2 was built into the Play store client itself. The cache/EULA issue isn't specifically related to IAB, it's related to setting up Play Services (and hopefully is unnecessary for most users, the cache part anyway).
It's a bummer to be in this transition period where Play Services has to be updated before your app can take advantage of it, but I think most people would agree that it's better than waiting for an OS upgrade.'
IABv3 内置于 Google Play 服务中,因此需要更新 Play 服务 apk。
V2 内置于 Play 商店客户端本身。缓存/EULA 问题与 IAB 没有特别关系,它与设置 Play 服务有关(希望大多数用户都不需要,无论如何缓存部分)。
在这个过渡时期,在你的应用程序可以利用它之前必须更新 Play 服务是一件令人沮丧的事情,但我认为大多数人都会同意这比等待操作系统升级更好。
See this ref: bug report, G+ post
回答by User2364902
Sometime if you haven't authenticated your device with Google account, may receive this error.
有时,如果您尚未使用 Google 帐户对您的设备进行身份验证,则可能会收到此错误。
回答by Drilon Blakqori
For anyone still facing this problem, in most cases iab isn't supported in your country like Williams said. You can use a VPN to make it work.
对于仍然面临此问题的任何人,在大多数情况下,您所在的国家/地区不支持 iab,就像威廉姆斯所说的那样。您可以使用 VPN 使其工作。
回答by John T
If you're located in Tonga(as me) or any other country where you're unable to buy apps in Google Play you must use a VPN to test billing. Otherwise you will get this error.
如果您位于汤加(和我一样)或无法在 Google Play 中购买应用的任何其他国家/地区,则必须使用 VPN 来测试计费。否则你会得到这个错误。