Working on trying out the market licensing service, and I'm running into a few problems with the sample application.
When I first ran the sample, I got an error saying that the application was not licensed. I linked my account to the simulator in order to get it to get the test response, and now I get an error saying "Application error: NOT_MARKET_MANAGED"
Does this mean that I have to upload the app to the market in order to test to see if it works?
Yes your app has to be on the market and if it already is, you have to have a version code number which is greater or equal than the one already published.
There may be another way. The comments on the sample's MainActivity read:
* The first thing you need to do is get your hands on your public key.
* Update the BASE64_PUBLIC_KEY constant below with your encoded public key,
* which you can find on the
* <a href="http://market.android.com/publish/editProfile">Edit Profile</a>
* page of the Market publisher site.
* <p>
* Log in with the same account on your Cupcake (1.5) or higher phone or
* your FroYo (2.2) emulator with the Google add-ons installed. Change the
* test response on the Edit Profile page, press Save, and see how this
* application responds when you check your license.
And when you log into http://market.android.com/publish/editProfile you will see an option for changing the License Test Response
:
Textually saying:
This License Test Response will be sent to devices using @gmail.com or the Test Accounts listed above for applications you have uploaded to Market. Additionally, this account (but not the Test Accounts) will receive this response for applications that have not yet been uploaded to Market.
If you click that selection list, you will see different options:
I guess all you have to do, for that initial sample LVL tutorial program, is change the response from Respond normally
to LICENSED
or any other setting you want to test.
UPDATE: It turns out that the above measure is insufficient. I still get the NOT_MARKET_MANAGED
error. I guess that "Market Licensing Example" must be uploaded as previous answers suggested. Note, however, that it cannot be the debug version:
Oh, and you can't really upload that "Market Licensing Example" as is. You must at least change the name of the package:
I can see how Google's sample/example system could be improved to become more developer-friendly...
Weird. After uploading the application (just uploading and saving draft, not filling any other required fields), the "Market Licensing Example" stops issuing the NOT_MARKET_MANAGED
error, despite the fact that clearly selected NOT_LICENSED
. Instead it responds with the message Allow the user access
. I also tried setting (for test & learning purposes) it to ERROR_SERVER_FAILURE
but I get the same Allow the user access
message.
Why?
You'd have thought "Saved Draft" would be just what this is for. Otherwise, you're selling an app which by definition cannot have been fully tested live.
Upload your app (.apk) to the market. The default state will be "Saved Draft", so it will not be be visible to the public, but you can still test the Licensing.
One other potential problem:
Make sure that the version you are testing/running has the same android:versionCode in the AndroidManifest.xml as the draft version in the market. If the versions differ, you will receive a NOT_MARKET_MANAGED error. (Apparently the RSA keypair used for license checks is on a per-app/per-version basis.)
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