I am using the LicenseChecker and ServerManagedPolicy in the com.google.android.vending.licensing library. I am quite confused though as I review some of the code there. There are comments in ServerManagedPolicy that state the following:
“You must manually call PreferenceObfuscator.commit() to commit these changes to disk.”
Am I supposed to be doing this? I don’t see any call to the commit() method in the Google code. I thought that by using the ServerManagedPolicy, I would not need to manually edit code in the library.
There is one call to the commit() method – at the very end of the processServerResponse() method.
And if you look closely you’ll notice that this call is made AFTER calling setValidityTimestamp(), setRetryUntil() and setMaxRetries() with data fetched from the Validity Server.
And that’s why these values are commited 🙂
Conclusion:
If the default behavior of ServerManagedPolicy is satistying for you, you DON’T have to change anything in this file.