My bad, LICENSED_OLD_KEY *will* pass as long as you don't have any
device restrictions setup, see this code (and I just tested it):
case LICENSED:
case LICENSED_OLD_KEY:
LicenseResponse limiterResponse =
mDeviceLimiter.isDeviceAllowed(userId);
handleResponse(limiterResponse, data);
break;
isDeviceAllowed for the default NullDeviceLimiter returns
Policy.LicenseResponse.LICENSED.
On 1 okt, 11:13, MarcoAndroid <[email protected]> wrote:
> Yes I know, but that's not what I'm having problems with. I see in my
> scenario (see first post) that I get back NOT_MARKET_MANAGED. And that
> translates in my app to 'not licensed' of course, because that's also
> returned for an app not in the market. But I expected LICENSED_OLD_KEY
> back based upon the LVL documentation. Since the scenario doesn't
> return that, will the scenario return LICENSED_OLD_KEY when the app is
> published, or will it also in that case return NOT_MARKET_MANAGED and
> thus all user with an older copy are forced to upgrade? If so, I need
> to tell my users that an upgrade should fix a 'not licensed' message
> if they did pay for it before... Totally not user-friendly of course!
>
> Hmm, might have found the answer regarding to how the default
> ServerManagedPolicy has implemented it when LICENSED_OLD_KEY is
> returned (though that does *not* answer my question yet why I don't
> get LICENSED_OLD_KEY back in my scenario with an unpublished but saved
> app):
>
> public boolean allowAccess() {
> long ts = System.currentTimeMillis();
> if (mLastResponse == LicenseResponse.LICENSED) {
> // Check if the LICENSED response occurred within the
> validity timeout.
> if (ts <= mValidityTimestamp) {
> // Cached LICENSED response is still valid.
> return true;
> }
> } else if (mLastResponse == LicenseResponse.RETRY &&
> ts < mLastResponseTime + MILLIS_PER_MINUTE) {
> // Only allow access if we are within the retry period or
> we haven't used up our
> // max retries.
> return (ts <= mRetryUntil || mRetryCount <= mMaxRetries);
> }
> return false;
> }
>
> Suprised it isn't handling LICENSED_OLD_KEY separately... since it
> says
> herehttp://developer.android.com/guide/publishing/licensing.html#server-r...
> "By default, the LicenseValidator class in the LVL provides all of the
> necessary handling of these response codes for you."
> But that should say I think: "... the LicenseValidator only allows
> access if the result is LICENSED or within the retry period".
>
> In the table below that text it it says kindof that the default
> LicenseValidator is not allowing access (notice the word Optionally):
>
> "Optionally allow access according to Policy constraints.
> Can indicate that the key pair used by the installed application
> version is invalid or compromised. The application can allow access if
> needed or inform the user that an upgrade is available and limit
> further use until upgrade."
>
> But that's getting nasty code-wise: in LicenseCheckerCallback I only
> have allow, dontAllow and errorCode. I don't have access to the
> detailed response there, right? So how to make distinction there, that
> is, check that LICENSED_OLD_KEY is returned? Might have to extend
> LicenseCheckerCallback with an oldKey() method or similar...
>
> On 28 sep, 22:47, Bret Foreman <[email protected]> wrote:
>
>
>
> > My understanding is that you test for a valid server response in your
> > code. So if you're not testing in the old code, it will run fine.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en