4

I just implemented LVL in my app. I first set up the test response to "LICENSED" in my developper account settings => everything works properly ; I receive this answer.

When I change the test response to "NOT_LICENSED", I still get the result "LICENSED" in my app even two hours after having changed the value in my developer account.

Any idea how to solve this issue ?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • I'm curious about this too as I implemented the same thing, but in my case, the response changes periodically throughout the day. I'll get the "LICENSED" response and hours later with no code changes or anything, I get "NOT_LICENSED". Goes back and forth. – hooked82 Aug 24 '11 at 15:58
  • To Graham: I use the ServerManagedPolicy. I know that there is q question of cache of several hours to handle the cases where the device is not connected (and avoid that the user has an app blocked when he uses it offline) but I think that there is no question of cache in my case as my device is connected. I thinks that a request is sent for each app start to the Google servers when the device is connected. But perhaps I am wrong. – toto_tata Aug 24 '11 at 16:13
  • 1
    An other point: I found here (http://groups.google.com/group/android-developers/browse_thread/thread/41d79e8849e14154?pli=1) this very surpising remark from a guy from Google :"I think the issue that people are seeing here (and as far as I can tell, the one Richard was experiencing) is that draft applications will always return LICENSED. This was done to facilitate testing, since draft apps can never be purchased. (They're in draft!) This doesn't seem to be documented well, so I'll make sure that gets fixed." Does it mean that the behaviour I get is normal ??? – toto_tata Aug 24 '11 at 16:15
  • I'm struggling to remember how LVL works off the top of my head but there is a difference in behaviour between a draft app, and an app with no draft uploaded. – David Snabel-Caunt Aug 24 '11 at 17:05
  • To David Caunt: I think that LVL doesn't work if you don't have a draft uploaded. Indeed, in this case, it means that your app (with a defined package name) is not present on the Google portal and thus, no communication can occur between your app and Google. Perhaps you meant: "there is a difference in behaviour between a draft app WITH NO APP IN PRODUCTION (case where LVL would not work with test responses ?), and a DRAFT app WITH AN APP IN PRODUCTION (case where LVL would work with test responses ?)" ? Thanks for your help. – toto_tata Aug 24 '11 at 19:42
  • I had this, but guessed it was a caching issue. I uninstalled the app and then installed it again and this time it returned the correct response. – Ricky Sep 28 '11 at 12:57
  • did you get any answer or were you able to solve it? I am still struggling with the same isseu – Snake Apr 05 '12 at 17:39
  • Honestly, I don't remember. What I know is that I removed all these licensing stuffs from my app as they induce many issues with some customers which get a "not licensed" response even if they bought the app. Conclusion: don't use the Google licensing stuffs. – toto_tata Apr 16 '12 at 14:50
  • Did you add your account as a test account? Can you use a device with the developer account set up as its main account? Those usually work for me. – aruwen Sep 27 '11 at 07:39

1 Answers1

4

As you know and already wrote in one comment, the ServerManagedPolicy has a cache. That means that once you got a positive response, this response will be taken as long as it is valid. The app will not contact the licensing server during the validity period of the last positive response, even if you are connected. The caching is not only for offline use but also to avoid too many time consuming network queries.

Here's what you should do: Instead of ServerManagedPolicy

mChecker = new LicenseChecker(this,//
                new ServerManagedPolicy(this,
                new AESObfuscator(SALT,getPackageName(),
                deviceId)), //
                BASE64_PUBLIC_KEY // The public licensing key.
        );

use StrictPolicy

mChecker = new LicenseChecker(this, new StrictPolicy(), BASE64_PUBLIC_KEY);

and try if it works. When you are done testing, change it back so your users can profit from the caching of ServerManagedPolicy.

Christopher Gertz
  • 1,826
  • 1
  • 15
  • 9