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.
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)));
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With