問題描述
Ứng dụng Giấy phép Android hiển thị Không được cấp phép? (Android License App showing Not‑licensed?)
I'am doing an app android license for paid application. In this app i gave base 64 public key & salt 20 random numbers according to my app details. My code is as follows:
initialized variables like this:
private static final String BASE64_PUBLIC_KEY = "xxxxxx";
private static final byte[] SALT = new byte[] {xxxxxxxxxxxxxxxx};
private LicenseChecker mChecker;
private LicenseCheckerCallback mLicenseCheckerCallback;
in oncreate() doing like this:
String deviceId = Secure.getString(getContentResolver(),Secure.ANDROID_ID);
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
mChecker = new LicenseChecker(this, (Policy) new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
mChecker.checkAccess(mLicenseCheckerCallback);
and My license checker callback function like this:
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
@Override
public void allow(int result) {
if (isFinishing()) {
return;
}
}
@Override
public void applicationError(int errorCode) {
if (isFinishing()) {
return;
}
}
@SuppressWarnings("deprecation")
@Override
public void dontAllow(int result) {
if (isFinishing()) {
return;
}
showDialog(0);
}
}
from this I exported apk file and Stored as a draft in google play and tested with test accounts which are given in google play as test accounts and same account used in my device also. I tested many times this app everytime it shows only Not Licensed with dialogue. what is the problem? plz help me..
參考解法
方法 1:
This error because of your public key, in the google play produces the different Base64‑encoded RSA public key
for every new application published from your google account. Check that key before creating your apk
for your application.
(by NagarjunaReddy、RajaReddy PolamReddy)