I’ve been following the developer.android.com page http://developer.android.com/guide/publishing/licensing.html#lc-lcc for directions on using the ServerManagedPolicy type licensing. I’ve added the Google Market Licensing Package to my application as a library, and I’ve included this code in my onCreate method:
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
mChecker = new LicenseChecker(this, new ServerManagedPolicy this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
At this point I find the instructions confusing. Much of the rest of the sample code on the website appears to be for developing a StrictPolicy or a custom Policy. The example supplied with the library also appears to be for a custom Policy.
How much of the website code is required to use the ServerManagedPolicy library? For example, the library did not come with any resources, yet the website code for doCheck calls a button and text widget. Do i add the doCheck code and make widgets, or is this unnecessary if using the library?
Is there an example of the ServerManagedPolicy library used in an application that does something other than check a license?
There is a sample project that shows how to do this in your android sdk folder:
C:\Program Files\Android\android-sdk-windows\extras\google\market_licensing\sample
It shows how to implement the usage of the serverManagedPolicy:
You can basically ignore all of the widget calls and modifications in the doCheck() method and focus entirely on the last line, which is:
This line is what actually fires the LicenseChecker class into action….everything else in the doCheck() method is just for disabling buttons and setting the text on a needless widgets (in your case).