【问题标题】:onServiceConnected is not called on Android 5.1.1 using InAppBillingService使用 InAppBillingService 在 Android 5.1.1 上未调用 onServiceConnected
【发布时间】:2015-10-11 18:45:58
【问题描述】:

我正在使用下面的代码来绑定 InAppBillingService。它在 Android 4.3 (Samsung Galaxy S3) 上运行起来就像一个魅力。但是,当我在 Android 5.1.1(Sony Xperia Z1) 设备上运行该应用程序时,onServiceConnected 只是没有在 logcat 上给出错误或警告的情况下被调用。

@Override
public void onCreate() {
    super.onCreate();
    Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    intent.setPackage("com.android.vending");
    bindService(intent, this, Context.BIND_AUTO_CREATE);
}

@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    mService = IInAppBillingService.Stub.asInterface(service);
}

@Override
public void onServiceDisconnected(ComponentName name) {
    mService = null;
}

顺便说一句,gradle 配置如下:

compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
    versionCode 13
    versionName "0.1.13"
    applicationId "com.kepraes.wtl"
    minSdkVersion 11
    targetSdkVersion 23
    signingConfig signingConfigs.config
}

PS:我没有使用IAB 库。

【问题讨论】:

    标签: android google-play-services in-app-billing


    【解决方案1】:

    好吧,我将设备恢复出厂设置并更新了所有 Google 应用。问题一去不复返了。我怀疑“Lucky Patcher”应用程序搞砸了一些东西,而恢复出厂设置只是解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-30
      相关资源
      最近更新 更多