我正在尝试实施 Android 许可证。一切都按照指示做了。但是当由于未经许可使用而需要关闭应用程序时。我得到例外:
06-12 09:11:31.384: E/LicenseChecker(383): Could not bind to service.
06-12 09:11:36.884: E/ActivityThread(383): Activity com.myapp.main.mactivity has leaked ServiceConnection com.google.android.vending.licensing.LicenseChecker@406a4428 that was originally bound here
06-12 09:11:36.884: E/ActivityThread(383): android.app.ServiceConnectionLeaked: Activity com.myapp.main.mactivity has leaked ServiceConnection com.google.android.vending.licensing.LicenseChecker@406a4428 that was originally bound here
06-12 09:11:36.884: E/ActivityThread(383): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:932)
06-12 09:11:36.884: E/ActivityThread(383): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:827)
06-12 09:11:36.884: E/ActivityThread(383): at android.app.ContextImpl.bindService(ContextImpl.java:1082)
06-12 09:11:36.884: E/ActivityThread(383): at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
06-12 09:11:36.884: E/ActivityThread(383): at com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
什么可能导致这种情况?
我创建的 onCreate 方法:
mHandler = new Handler();
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
和 onDestroy:
@Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
那么这个例外到底意味着什么?