Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android License Test Response - Never works

I've been working on an Android App that has already been published to Google Play. For the next update (versionCode = 3) my client wants to include the LVL licensing scheme.

The first thing I did was set up a static test response from the licensing server. I set the test response to LICENSED. After reading this in the documentation:

This License Test Response will be sent to devices using [my email address] or the Test Accounts listed above for applications you have uploaded to Google Play. >Additionally, this account (but not the Test Accounts) will receive this response for >applications that have not yet been uploaded to Google Play.

I thought, not a problem, since my developer account email is the same as my Google Play account email on my testing devices. So I should receive the test response when debugging the App.

After that, I read through all the other licensing documentation and sample code and integrated it into the App. I used a ServerManagedPolicy with the correct base64 public key and 20 random generated bytes as the salt.

Once everything looked good I uploaded it to the device to test it, but instead of receiving the LICENSED response that I expected, I am always receiving a NOT_LICENSED response. I went back and made sure that:

  1. I was connected to the internet.
  2. I was signed in to my developer account on Google Play.
  3. The LicenseChecker was using the correct public key.
  4. Clearing my Google Play cache.

At first, I thought maybe it had something to do with the caching, so I tried using a StrictPolicy instead. Same response. Since I haven't purchased the App from the store, I'm under the impression that the licensing server is responding normally instead of sending the static test response. Here are some other things I have tried:

  1. Waiting 24 hours and trying again.
  2. Tried building the App with the android debug key, as well as the current distribution key.
  3. Setting up and using a different test user account on Google Play. I made sure to add this email account to the 'Test accounts' section in the developer console.
  4. Uploading the APK to Google Play, but not publishing it.
  5. Incrementing the versionCode from 2 to 3. This is interesting, because instead of responding NOT_LICENSED it returns the 'application error code' ERROR_NOT_MARKET_MANAGED.

This leads me to believe that the license server is always responding normally, instead of sending the static test response I set up to my developer account. I have a feeling it may be because the App is already published, but I cannot risk publishing a debug build just to test wether or not it is working.

Has anyone been in this situation before? Any help is greatly appreciated.

like image 739
Paul Avatar asked Dec 01 '12 23:12

Paul


People also ask

How do I add license tester to Google Play console?

Navigate to Google Play Developer Console. Click on the Settings and select the License Testing panel. This page lets you set up the main components for test accounts and manage test responses. Add the tester account that you will use for testing in-app purchases with an Android device.

How do I check my Google Play Billing Library?

To test your Google Play Billing Library integration using test tracks, do the following: Publish your app to a test track. Note that after you publish an app to a testing track, it can take a few hours for the app to be available for testers. Ensure each tester opts-in to your app's test.

How do I check in-app purchases?

On selecting the device, the uploaded/selected app will automatically open in the device in question. Alternatively, you can sign in to Google Play Store, download and install a published app and test its in-app purchase feature. Just pick the Install via Google Play Store option.


2 Answers

I had the same issue but was able to resolve it. Here are the things I did to fix: 1) on my device, I removed all google accounts except the test account I had configured for. Apparently, play store was still trying to use a non testing account.

2) I had to activate test status for my developer account even though I'm the main developer and only tester.

the version increment thing did not help and honestly was a distraction.....

like image 134
rainman333 Avatar answered Oct 19 '22 23:10

rainman333


I've spent hours and even days with the same problem, it is documented here and elsewhere, that pre-published license test is hit and miss, and more miss than hit from what I discovered.

The only way I've found to make it work "more reliably" (but still not totally reliable) is to have a hardware device that is a reset to factory defaults, then set it's PRIMARY google user as the same one as your dev account that has the app uploaded to test with.

The special AVDs are also not very reliable.

like image 24
logray Avatar answered Oct 19 '22 23:10

logray