• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Licensing always denies: Caching issue?

Fmstrat

Newbie
Aug 5, 2010
13
1
Hey everyone,

I'm having a really odd issue with licensing. So, if I set my license up as a Strict policy with no caching, IE:

StrictPolicy strictPolicy = new StrictPolicy();
mChecker = new LicenseChecker(this, strictPolicy, BASE64_PUBLIC_KEY);
with logs:

08-20 17:36:56.901: INFO/LicenseChecker(20257): Binding to licensing service.
08-20 17:36:56.931: INFO/LicenseChecker(20257): Calling checkLicense on service for com.nowsci.android.widgets.unread
08-20 17:36:56.931: INFO/LicenseChecker(20257): Start monitoring timeout.
08-20 17:37:03.341: INFO/LicenseChecker(20257): Received response.
08-20 17:37:03.341: INFO/LicenseChecker(20257): Clearing timeout.
Then everything works fine using the developer account and setting the option in the profile field of LICENSED or NOT_LICENSED. However, if I use a Server Managed policy, IE:

mChecker = new LicenseChecker(
this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)), BASE64_PUBLIC_KEY);
with logs:

08-20 17:31:11.961: INFO/LicenseChecker(20110): Binding to licensing service.
08-20 17:31:11.991: INFO/LicenseChecker(20110): Calling checkLicense on service for com.nowsci.android.widgets.unread
08-20 17:31:11.991: INFO/LicenseChecker(20110): Start monitoring timeout.
08-20 17:31:21.991: INFO/LicenseChecker(20110): Check timed out.
I get an invalid license no matter how I set the option in the profile for the developer account. Anyone know why this would be the case? Could it be cache related? And if so, how do I clear it? Uninstalling the app seems to make no difference. Notice the difference in the log entry, too (bold). It's like I get a timeout using ServerManagedPolicy.

Thanks.
 
Interesting. Hopefully this will help anyone else running into this issue. This was happening due to bad service areas. It was pure chance that it went through as a strict policy. In an EDGE area with 2 bars, it's constantly acting this way. To ensure other users don't have the problem, I've increased the timeout in LicenseChecker.java.

So, in com.android.vending.licensing.LicenseChecker.java, line 64, it was:

private static final int TIMEOUT_MS = 10 * 1000;
and I've changed it to:

private static final int TIMEOUT_MS = 30 * 1000;
Works like a charm now.

Thanks.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones