Tom Cheung
Tom Cheung

Reputation: 89

How to test licensed android apk without buying from market?

I would like to publish paid application to android market, so I added android LVL into my apk. I have tested on my mobile. When I install apps, it shows the permission to check phone status, market license. After installation, I try to run and prompt "license not found and go to market to purchase". It seems that it works as apk is not allowed to run without downloading from market.

The problem now, how can I test or emulate the buyer situation ? That means will buyer able to run my apps after they buy my apps. If they cannot run and prompt license not found after purchasing, then my license check has problems. I already include my gmail into "Edit profile" in dashboard of market.android.com. I changed the status to LICENSED, NON-LICENSED, OLD LICENSED. but no response sent to my gmail. So I don't know how to do it.

Does it already done on Google license server or do I need to modify android market license code package? I check that there is code to handle request for the case like license, no license, old license, market error and so on.

It is because there is no market in android emulator, also I cannot add google account(only exchange account) in account and sync in emulator (tried in 1.6,2.2 and 2.3). So I only can test in my real android phone.

Anyone has experience or some methods to test paid apps without buying own apps from market, how can I also test the response from license server as well if anyone buy my apps ?

Upvotes: 5

Views: 8978

Answers (3)

Androidcoder
Androidcoder

Reputation: 4679

altough the docs give long detailed instructions on adding licensing to an app, and much of the sample code can be edited for bare-bones licensing, i've found little on testing that licensing with the Google API as if it were the buyer of your app. the "Setting Up for Licensing" in the docs details "signing into an authorized account in a runtime environment", but that's just the tip of a large iceburg for what you want to do. here are the steps i use:

  1. create an AVD with the Google API
  2. create a new dummy gmail/google account to test with
  3. add that account to the AVD. going to "settings/accounts/add" in the AVD is easiest for this. using the "dev tools" is buggier: click "dev tools/accounts tester", click the word "corporate", which is a dropdown list window although the design doesnt make it that apparent, click the word "google" in the new window that appears at the bottom of the app screen instead of where the word "corporate" was and remains, click "add" which brings you to the same window that just going to "settings/accounts/add" brings you.
  4. add that account to the "test accounts" section of your Developer Console
  5. install the "exported" .apk file to the AVD (the one you uploaded). this has to be done with the command prompt using "adb", at least to my knowledge.
  6. run the exported .apk with your dummy google account and see that it responds according to however you set your "test reponse" in the Developer Console
  7. test the other Developer Console test responses

whew. refer to the docs or a google search for further elaboration on each step.

Upvotes: 0

celerCalderas
celerCalderas

Reputation: 21

It's been a few months, but this bump might help someone out there - just answered this question for a friend of mine who claimed to not find the answer here. Sounds like you don't have a Google experience emulator setup. Create a new emulator using the Google API version of android targets, you ought to be able to do that for target level 3 on upwards. With this API in place you'll have access to the authentication servers in your emulator (if you don't have the Google APIs, they're available in the sdk manager under available packages then I think third party packages iirc). You don't even need to upload an unpublished apk unless your testing in-app purchasing (possibly for test accounts other than the dev account, I do all my testing under dev so I'm not entirely sure on that note).

Upvotes: 2

Ted Hopp
Ted Hopp

Reputation: 234847

You can set up a test account through your publisher account panel. (You will need to set up a publisher's account if you haven't already.) Check the developer documentation on licensing for details, especially the section on administrative settings for licensing.

Upvotes: 0

Related Questions