Search code examples
androidtestingin-app-billing

In-app billing and license test accounts


I am very confused about this, both from the developer site and other similar questions.

I am trying to use V3 in-app billing. Seems to work with the static responses. Want to move on to testing with test purchases using license test accounts.

Basically - it is not working.

A signed app has been uploaded to the developer site (over 6 hours ago), and the app installed on the device, whilst not being signed with the same release key (it's a debug build and key), should work because Android Developers says "you only need to upload your application as a draft application. However, you must sign your application with your release key before you upload it as a draft application. Also, the version number of the uploaded application must match the version number of the application you load to your device for testing". Ie the code on the device apparently doesn't need the same key providing versionCode matches.

My developer console login is - say - [email protected], and I have a license test address registered (on the developer console) of [email protected]. The primary account on my phone is also [email protected]. However I do have a secondary account on there of [email protected]. I do NOT want to have to reset my phone and change its one and only account to [email protected].

Android Developers says "The only way to change the primary account on a device is to do a factory reset, making sure you log on with your primary account first" which seems to imply I might have to. It also then says "If the device has more than one account, the purchase will be made with the account that downloaded the app. If none of the accounts has downloaded the app, the purchase is made with the first account" which partially contradicts the first statement. Most of the text on the site appears to apply to pre-V3 code, OS 1.4 etc, so I am not sure how relevant it is.

I notice that Google Play allows me to select the account to use, and both the above show up in the list. Therefore, if I select that second (test) account in Google Play, should that be not sufficient to start testing with that test account?

What actually happens is, whatever account I have selected in Google Play, on starting a purchase I get a message "this version of the application is not configured for billing through Google Play".

Is this because I really do have reset the device and make the primary account [email protected], or because of something else, possibly in the code?


Solution

  • I have some more information now, together with the answer above:

    1. Once I loaded the device with the release signed key the message on a purchase attempt changed to "the publisher cannot purchase own item".
    2. I tried logging in to Google Play with both my accounts and it made no difference. When logged in with the test account I also tried to find the app in the play store. Didn't show up even to the test account (draft app). (I hoped the test account could download it even as draft and therefore following the rules above about multiple accounts I could test purchase with the test account, but no).

    Therefore I conclude:

    1. Can only test on a device with an app signed with the same key as the one uploaded to the play store - whatever Android Developers might say.
    2. The ONLY account that can test purchases on a device is the first set (primary) account.
    3. Best therefore to have a completely new account as one's Developer Console account (bit late now).

    Would be happy to hear if anyone can contradict the above.