【发布时间】: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