Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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:

enter image description here

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:

enter image description here

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:

enter image description here

Oh, and you can't really upload that "Market Licensing Example" as is. You must at least change the name of the package:

enter image description here

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.)

After a bit of a struggle I got this working. You can't use the LVL sample as is.

Here's what I did:

  • modify the project's package to something else (I used: lvl.test)
  • set MainActivity's BASE64_PUBLIC_KEY to the one in your Developer Console profile.
  • export the signed app
  • go to Developer Console and upload the app (create dummy images and give it a dummy name and description etc. just so that it saves and is listed as 'Unpublished')
  • install the exported app (from your filesystem) to your test device (i.e. adb install bin/path/to/your.apk)
  • on your device, open Android Market go to: Settings>Accounts> and select the one that corresponds to your Developer Console account
  • you can now select a static License Test Response in your Developer Console Profile and save it. When you run the LVL sample on your device the response will correspond to the one you picked!

From my experience, the app has to be published before LVL starts working, incl. static response testing. For me ERROR_NOT_MARKET_MANAGED went away only after publishing although the docs say you can Debug and test an application's licensing implementation, prior to publishing the application.

Cool part is you can publish while only having alpha/beta builds -- the app won't really go live, only testing accounts will be able to use it.

When you're preparing for initial release, it may seem unnatural to hit Publish before you're completely sure everything is in working order (and the fact that you have to put in the description and screenshots before you can do that is even more alarming -- you'd think those are final touches) -- but you should, just make sure you've made a sane choice about the package name and whether the app is paid or free -- those things can't be changed after publishing. Publishing alone does not make the app public; unless you have a Production build don't worry about accidentally making an untested version go live.

This is related so it might help somebody:

I was testing on an Asus transformer and had to delete all non-developer accounts to get license testing to work (including my yahoo account). Once the other accounts were deleted all of the steps worked without a problem.

In my case I was getting because of Version code difference as.. Already published apk's version code = 2

and after some testing release new apk's I had set version code to 5

which was causing this error as version difference should be exact 1 with currently published apk.. same was applied with version name too..

If you already tried all the suggestions above try this:

I had the same response for a while and I could not figure out why this was the case. I read the entire documentation on App Licensing and still receiving the same annoying NOT_MARKET_MANAGED response code.

I was finally abe to resolve the problem by changing my applicationId in the AndroidManifest.xml file. I rewrote an app from scratch starting with a blank new project. The problem was that I did not use the exact correct applicationId. The problem was that the original application on the Google Play Store used a letter in upper case while I wrote all letters in lower case in the newly created project.

Since I corrected the applicationId to match 100% (including casing) I get the expected behavior of the licensing service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top