Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase LVL cache-valid time?

I've implemented LVL server managed policy in my app. I know that lvl server response is cached in a device for some period of time so users are able to use a app without interent connection (lvl uses cached license then). I would like to know exactly how long that period is and how I can increase it. Basically, lvl I've implemented checks license everytime the app starts and I would like to increase cache-valid time to 60 days.

like image 905
XorOrNor Avatar asked May 15 '13 14:05

XorOrNor


2 Answers

I haven't found the actual value of the lvl cache-time set by google servers, but I found how to change it. In the ServerManagedPolicy.java file change:

setValidityTimestamp(extras.get("VT"));

to whatever you like (here to 30 days):

setValidityTimestamp(String.valueOf(System.currentTimeMillis() + (MILLIS_PER_MINUTE * 60 *24*30)));
like image 176
XorOrNor Avatar answered Sep 27 '22 23:09

XorOrNor


replace in ServerManagedPolicy.java

setValidityTimestamp(extras.get("VT"));

to

setValidityTimestamp(String.valueOf(System.currentTimeMillis() + (MILLIS_PER_MINUTE * 60 * 24 * 30 * 3)));

MILLIS_PER_MINUTE gives you output 60000:

60000 * 60 * 24 * 30 * 3 = 7776000000 millis, or 90 days

return remaining time in days back to user:

(mValidityTimestamp - System.currentTimeMillis())/(60*60*24*1000)

I am using SharedPreferences to write the data and return back to user DAYS until next binding and checking of license

like image 41
ivan Avatar answered Sep 28 '22 00:09

ivan