Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

android - How do you deal with LicenseCheckerCallback.ERROR_NOT_MARKET_MANAGED error code?

Using com.android.vending.licensing you can check if your app is licensed or not. There is a callback, applicationError() that tells you if anything went wrong. Today I encountered error ERROR_NOT_MARKET_MANAGED and I can't figure out how I should deal with it!

Here's what I did:

  1. On Google Play, I added my e-mail address as a test account.
  2. On Google Play, I saved my app (unpublished) with versionCode="10".
  3. On my machine, I changed to versionCode="11".
  4. License check now fails with error code ERROR_NOT_MARKET_MANAGED.

The question is; should I handle this error or is this an unrealistic scenario?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

ERROR_NOT_MARKET_MANAGED: the name really tells all about itself, application is not managed by Android Market (now called Google Play). More specifically, the version 11 of your application is not uploaded or published in Google Play.

should I handle this error or is this an unrealistic scenario?

I would consider this as an unrealistic scenario. You don't need to do anything special in code as long as you upload the new app version in Google Play. ERROR_NOT_MARKET_MANAGED is more like a LVL development warning which help developer properly implement license checking code and follow the correct procedure for testing license checking at project build time. check out the comments in LVL sample code:

private class MyLicenseCheckerCallback implements LicenseCheckerCallback {

    ... ...

    public void applicationError(ApplicationErrorCode errorCode) {
        if (isFinishing()) {
            // Don't update UI if Activity is finishing.
            return;
        }
        // This is a polite way of saying the developer made a mistake
        // while setting up or calling the license checker library.
        // Please examine the error code and fix the error.
        //String result = String.format(getString(R.string.application_error), errorCode);
        //String result = "Error";
        //handleLicensingResult(result);
    }
}

The whole point of integrating LVL into your application is to use Google Play publish your application, and use Google Play client application download and install your application (see Requirements and Limitations section in dev guide). I can't see any point that can cause this applicationError at runtime on end user's device if:

  1. Developer follow the correct procedure to upload (for testing LVL) or publish (for real release) in Google Play.
  2. End user use Google Play client application purchase, download and install the application.

If a end user somehow get a copy of your application (with LVL integrated and uploaded/published in Google Play) from other channel (not purchase via Google Play) and trying to install it on his device (with Google Play client application installed on that device), in this case, LicenseCheckerCallback will go to dontAllow() rather than applicationError(ApplicationErrorCode errorCode).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...