问题描述
使用 com.android.vending.licensing
您可以检查您的应用是否获得许可.有一个回调,applicationError()
,它会告诉你是否有任何问题.今天遇到错误ERROR_NOT_MARKET_MANAGED
,不知道该如何处理!
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!
这就是我所做的:
- 在 Google Play 上,我将我的电子邮件地址添加为测试帐户.
- 在 Google Play 上,我使用
versionCode="10"
保存了我的应用(未发布). - 在我的机器上,我改为
versionCode="11"
. - 许可证检查现在失败,错误代码
ERROR_NOT_MARKET_MANAGED
.
- On Google Play, I added my e-mail address as a test account.
- On Google Play, I saved my app (unpublished) with
versionCode="10"
. - On my machine, I changed to
versionCode="11"
. - 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?
推荐答案
ERROR_NOT_MARKET_MANAGED
:这个名字确实说明了一切,应用程序不由 Android Market(现在称为 Google Play)管理.更具体地说,您的应用程序版本 11 并未上传或发布在 Google Play 中.
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?
我认为这是一个不切实际的情况.只要您在 Google Play 中上传新的应用版本,您就不需要在代码中做任何特别的事情.ERROR_NOT_MARKET_MANAGED 更像是一个 LVL 开发警告,它帮助开发人员正确实施许可证检查代码,并在项目构建时按照正确的程序测试许可证检查.查看 LVL 示例代码中的注释:
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);
}
}
将 LVL 集成到您的应用程序中的全部意义在于使用 Google Play 发布您的应用程序,并使用 Google Play 客户端应用程序下载并安装您的应用程序(参见 要求和限制 部分在开发指南).如果:
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:
- 开发者按照正确的程序在 Google Play 中上传(用于测试 LVL)或发布(用于实际发布).
- 最终用户使用 Google Play 客户端应用购买、下载并安装应用.
如果最终用户以某种方式从其他渠道(不是通过 Google Play 购买)获得您的应用程序的副本(集成 LVL 并在 Google Play 中上传/发布)并尝试将其安装在他的设备上(使用 Google Play 客户端应用程序)安装在该设备上),在这种情况下,LicenseCheckerCallback 将转到 dontAllow() 而不是 applicationError(ApplicationErrorCode errorCode).
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).
这篇关于您如何处理 LicenseCheckerCallback.ERROR_NOT_MARKET_MANAGED 错误代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!