Reputation: 783
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?
Upvotes: 3
Views: 5253
Reputation: 46703
I had this issue also when dealing with expansion files and nothing changed in my app except updating the expansion file and the manifest version #.
It took over an hour before my app would finally find and download the new expansion file. Up until that point, it just kept giving random errors like "Error contacting licensing server", then it would say that it downloaded the file (but the byte size was 1 byte, so it didn't) and the file validation would fail, etc.
As Joda said in the comments, Google is just slow sometimes. Wait a few hours and try again. Doing the steps that Christine listed in her answer can also help, but it might just be that you need to wait longer.
Upvotes: 0
Reputation: 298
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
Upvotes: 4