I looked in vain for some "simple" instructions. Below, minus several
false steps, is what worked for me. Please offer simplifications,
corrections, comments.
Given a working SDK that compiles and executes your program on an
emulator...I'm working under Windows XP from command lines (no
Eclipse):
Update SDK.
1. Download the emulator add-on because apps using LVL need the
"Android Market app" which comes preinstalled on user devices. Stock
SDK emulator doesn't include AMarket app emulation. Therefore,
download
"Google APIs Add-On platform, API Level 8 (or higher)" =
"Google APIs by Google Inc., Android API 8, revision 2"
to add LVL part of AMarket app to your emulator. (Look for this module
under "Third party Add-ons" even though it's from Google.) (What's the
advantage in taking the add-on's newest version?) Level 8-2 first
downloads Platform 2.2 as a prerequisite. (By the way, the five basic
parts of the Android SDK are Tools, Platform-tools, Platforms,
Documentation, Samples)
2. Download the LVL (Licensing Verification Library). I had to cycle
Windows at this point because Win Explorer couldn't initially see
directory "androdi-sdk-windows\extra" where LV Lib went, which
differs from where doc said it would go.
Prepare sample app.
3. Copy "market_licensing\sample" as a new app, say
"LVLsample\src\com\example\android\licensing".
This name wouldn't work if uploaded to Market.
4. Copy
"android-sdk-windows\extras\google\market_licensing\library\src\com
\android"
into
"LVLsample\src\com",
that is, your src\com now has two subdirectories: android\... and
example\.... (Alternately make this "market_licensing\library" a lib
requiring a different compile.)
5. Get your public key from http://market.android.com/publish/editProfile.
6. Prepare LVLsample as a new app (android -v update project ...) and
compile following directions at the top of MainActivity.java. I had to
get and update a build.properties from another app, remove the "lib"
line and personalize other parts of default.properties. At the end
both "debug" and "release" builds worked for me.
Run the app, see output.
7. Create an AVD incorporating the partial AMarket emulation by
setting its "Target" to "Google APIs...API Level 8".
8. Start the AMarket enabled AVD while connected to internet. On
emulator at "Settings", "Accounts & sync" add your gmail account with
both "sync" buttons checked, even though account shows "Sync off". (Do
the settings of the two sync buttons matter? Must the emulator have
constant internet access during bootup? Later can I remove and
restore the internet periodically without harm?) The LVL sample runs
but won't respond to the server unless the emulator sees the internet.
Check connection by clicking the Browser in the emulator.
9. Install LVLsample\MainActivity-debug.apk (or -release.apk) to
emulator.
10. With your favorite desktop browser, login to your publisher's
console (same url as step 5; same email and password as step 8).
11. Set desired return on publisher' console "Edit profile" page,
'Save', and see same when "Marketing Licensing" runs on emulator.
Repeat set, save, see.
Some failures announce the error on the emulator screen, others just
say "Don't allow user access" (with popup) and log the type of
error. After a "LICENSED" response, ddms shows that you will keep
getting same from local cache for one minute before app queries the
server again. Also, the difference between a local error (the server
was never queried) and an error response from the server is not as
straight forward as it might be.
One anomaly I don't understand: In several comments Server Managed
Policy java says "You must manually call Preference
Obfuscator.commit() to commit these changes to disk." Yet on
successive runs they appear to be committed to SharedPreferences even
though I didn't add any commit()-s.
I hope this helps someone and is not too specific to my particular
setup.
Hal Harrison.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en