I'm trying to publish my app for 3 hours now, but I can't get the license check to work.
In my onCreate
method I got this code:
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
String pckName = getPackageName();
// 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, pckName, deviceId)), BASE64_PUBLIC_KEY);
mChecker.checkAccess(mLicenseCheckerCallback);
And the callback looks like this
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
// Should allow user access.
Main.isLicensed = true;
}
public void dontAllow(int policyReason) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
Main.isLicensed = false;
}
public void applicationError(int errorCode) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
Main.isLicensed = false;
}
}
Only the dontAllow method gets called. And the response code is 291.
In logcat I get "Error contacting licensing server."
The app is uplodaded to the developer console.
The public key is correct copied (without any spaces).
The phone (Samsung Galaxy S2 with Android 4.0.4 Stock) got internet
Any ideas?
Code looks good to me. But I have a similar problem at the moment. Did you ...
Let me know, if solved the problem.
Thanks Best wishes