Now that we've waded through all the docs and created the changes needed to implement android licensing, we've actually gotten to the testing as described in our previous post. It was returning some kind of application error, something like not under the control of the android market. Googling tells us that you actually have to load up the app *as a draft* to the marketplace.
I did so using this script, which I have already prepared for another app.
#!/bin/bash
############################################################################
#
# Install script for android apk file.
#
# The apk file generated is deployable to the Android App store
#
# The assumption of the script is that the apk name (less ".apk" corresponds
# to the project name. Also, it must be run from a directory at the same level
# as the project.
#
# The paramater to the script should be the project name
#
# The script first copies the apk from the project's bin directory to its deploy directory
#
# It then signs the apk file
# To zip align it, it deletes any exist "temp" file, zipaligns the deploy apk file to temp
# deletes the origin deploy apk, and move the aligned temp to the deploy apk.
#
#
#############################################################################
echo "Uninstalling $1...."
#adb uninstall "$1.apk"
echo "copying from project's bin to its deploy direcotory..."
cp ../$1/bin/$1.apk ../$1/deploy/
echo "signing jar..."
jarsigner -verbose -keystore my-release-key.keystore "../$1/deploy/$1.apk" alias_name
echo "Checking if APK is verified..."
jarsigner -verify "../$1/deploy/$1.apk"
Now, it turns out I had a bit of an issue with the signing.., I got some kind of invalid size on the jar sign. I had the url to solution posted, but lost it when my browser crashed. But basically the problem is the jar has already been signed. To get around it, just go to android tools in Eclipse and export an unsigned package, and then you can sign the apk.
Once it's uploaded (don't publish it yet! unless you're daring...) you run the test of the app again. Although I didn't get the dialogs, I did get this showing up in the log:
D/QuizStartActiity( 2111): onCreate
I/LicenseChecker( 2111): Using cached license response
D/QuizStartActiity( 2111): >>>>>>>>>>>>> allow!
Now, if we go to https://market.android.com/publish/editProfile
and change the status from licensed to unlicensed, it will probably still say "allow" because it's cached. Let's test that.
Let's clear it, and test it:
AppState appState = ((AppState) getApplicationContext());
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(appState);
// this.myDbHelper = Utils.createDB(this);
SharedPreferences.Editor prefEditor = sharedPreferences.edit();
prefEditor.clear();
prefEditor.commit();
No, it didn't work. How to clear the cache it's looking at?
http://support-remote.splashtop.com/entries/20227106-application-not-licensed
This says how to do it - but also indicates problems! The last thing I need is to be fussing with this.
p.s. How to clear cache:
1. Go to 'settings' of your android system.
2. click 'Applications'.
3. click 'Manage applications'
4. Find your app, and click it.
5. You will see 'clear data' button. click it.
6. Will pop up 'warning' message, just click 'OK'.
Ok, now let's try it again..
/ServerManagedPolicy( 2796): License retry timestamp (GT) missing, grace period disabled
W/ServerManagedPolicy( 2796): Licence retry count (GR) missing, grace period disabled
I/dalvikvm( 2796): Total arena pages for JIT: 11
D/QuizStartActiity( 2796): >>>>>>>>>>>>> allow!
D/
It looks like it couldn't get hold of the server, and defaulted to allow. Hmmm....well, for now, I'm going to drop it. I'm concerned about hassling customers and also about having to muck around with supporting the app.
No comments:
Post a Comment