我想實現Android許可。通過指示做了一切。但是,當需要關閉應用程序由於un license的使用。我得到免除:Android無法綁定到服務LicenseChecker
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 [email protected] 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 [email protected] 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();
}
那麼這個異常意味着真的嗎?
您是使用最近的Android Market/Google Play商店應用在真實設備上進行測試的嗎? –
我正在用模擬器測試。要查看該用戶未經許可 – Streetboy
在模擬器上運行與未經許可無關。此外,使用仿真器時已知這已被破壞。按照此處的說明進行設置,但更好地在真實設備上進行測試。 http://developer.android.com/guide/market/licensing/setting-up.html#test-env –