无法在android中为应用内计费建立连接 [英] Not being able to establish connection for In app billing in android
问题描述
我正在尝试将 In app billing v3 集成到我的应用中.我调用以下函数进行初始化.
I am trying to integrate In app billing v3 in my app. I call the following function to initialize.
public static void SetupInappBilling()
{
mHelper = new IabHelper(context, base64EncodedPublicKey);
mHelper.enableDebugLogging(true);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener()
{
public void onIabSetupFinished(IabResult result)
{
if (result.isSuccess())
{
Log.e("tag", "connected");
ConnectionEstablished = true;
}
else
{
Log.e("tag", "not connected");
ConnectionEstablished = false;
}
}
});
}
但我没有在 OnIabSetupFinishedListener 中收到回电谁能告诉我如何解决这个问题
but i dont get call back in OnIabSetupFinishedListener Can anyone tell me how to fix this issue
推荐答案
如上所述,示例 IabHelper
实现忽略了 bindService()
调用的返回值.
As discussed, the example IabHelper
implementation ignores the return value of the bindService()
call.
bindService()
如果无法绑定到服务,则返回 false
.在这种情况下,不会调用任何回调.在这方面,bindService()
的返回值对于程序逻辑是必不可少的,绝对不能被忽略;示例应用程序在这里并不完美.
bindService()
returns false
if it cannot bind to the Service. In this case, no callbacks will ever get called. In this respect, the return value of bindService()
is essential for the program logic and should never be ignored; the example application is not exactly perfect here.
如果我没记错的话,绑定到 IAB V3 不起作用的条件是:
If I recall this correctly, conditions where binding to the IAB V3 will not work are:
- 只有 IAB V2 可用(它使用不同的类名)
- Google Play 未完全设置
这篇关于无法在android中为应用内计费建立连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!