许可证响应代码——策略实际上看到了什么?
在服务器响应附加文档中,我发现:
当网络问题阻止或中断许可证检查时,Android Market 客户端会通过向策略的 processServerResponse() 方法返回“RETRY”响应代码来通知应用程序。如果出现系统问题,例如应用程序无法与 Android Market 的 ILicensingService 实现绑定时,LicenseChecker 库本身会使用“RETRY”响应代码调用 Policy processServerResonse() 方法。
遗憾的是,RETRY 未列为列出的响应代码 服务器返回,当我查看 LVL 源代码时,似乎 Android Market 客户端实际上返回服务器响应代码之一,并且库中的 LicenseValidator 类决定何时将其转换为 RETRY 响应地位。
此外,在有关实现自定义策略的部分中,有这样的内容在指南中:
请注意,Android 电子市场客户端会自动重试失败的请求,因此在大多数情况下,您的策略无需重试。
我觉得这很令人困惑。客户端只是报告记录的服务器响应代码之一,还是执行更多操作?例如,如果设备处于飞行模式,自定义策略是否需要处理 RETRY 或 ERROR_CONTACTING_SERVER?策略(或应用程序)应该处理重试,还是客户端自动执行?
In the docs on server response extras, I find this:
When network problems prevent or interrupt a license check, the Android Market client notifies the application by returning a "RETRY" response code to the Policy's processServerResponse() method. In the case of system problems, such as when the application is unable to bind with Android Market's ILicensingService implementation, the LicenseChecker library itself calls the Policy processServerResonse() method with a "RETRY" response code.
Unfortunately, RETRY is not listed one of the listed response codes that the server returns, and when I look at the LVL source code, it appears that the Android Market client actually returns one of the server response codes and it is the LicenseValidator class in the library that decides when to turn that into a RETRY response status.
Furthermore, in the section on implementing a custom policy, there's this in the guidelines:
Note that the Android Market client automatically retries failed requests, so in most cases there is no need for your Policy to retry them.
I find this confusing. Does the client simply report one of the documented server response codes, or does it do more? If the device is in airplane mode, for instance, does a custom policy need to deal with RETRY or with ERROR_CONTACTING_SERVER? Should the policy (or application) deal with retries, or does the client do it automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论