Cannot get Android Market Licensing (LVL) working reliably. Almost always returns RETRY

北战南征 提交于 2019-11-27 08:19:03

问题


I am trying to get android licensing to work in my first Android application.

I have followed the online guides and have integrated the LVL Code using the ServerManagedPolicy.

Regardless of what license test response I set in the developer console I almost always (9 times out of 10) get a LicenseResponse.RETRY. Because DEFAULT_MAX_RETRIES = "0" this is always converted into NOT_LICENSED

I've tried:

  • turning WiFi On / Off
  • running paid apps I bought (they all work!)
  • unplugging the usb
  • running in a vm and my real phone

I always get the same result. On the few occasions that I've had a licensed response it has not had any of the extras attached to increase the max retries. I think this is the crux of the problem - the first time I try and license I have no retry or validity period toleration in the default settings.

How can I get this working reliably?


Edit 1


Found this in the logs. Does this imply there is a problem connecting to the android market app?

08-18 21:12:16.071: INFO/LICENSE(10852): checkLicense
08-18 21:12:17.271: INFO/LicenseChecker(10852): Binding to licensing service.
08-18 21:12:17.281: WARN/ActivityManager(80): Unable to start service Intent { act=licensing.ILicensingService }: not found
08-18 21:12:17.281: ERROR/LicenseChecker(10852): Could not bind to service.
08-18 21:12:17.301: INFO/LICENSE(10852): dontAllow

回答1:


There are two things that might help you:

  1. Assuming you are using the Developer Console to simulate a response, it sometimes takes more than a few minutes to refresh the response you got from previous tries. So if you simulated a FAILED response, you probably need to wait for a while before you can receive a SUCCESS response. Sometimes even rebooting your device will not help so you just have to wait.
  2. The LVL mechanism has some issues and even on users' devices you might get a FAILED response when there is no internet connection for a while on the device, or some other network error. What I recommend is to have several retries on top of the LVL built-in retries as I found it can't be trusted and prone to errors. It would probably reduce the number of false-negative reports you'll get from your users...



回答2:


Make sure that this is in your AndroidManifest:

<uses-permission android:name="com.android.vending.CHECK_LICENSE" />

That is required to run the check license code.



来源:https://stackoverflow.com/questions/7033066/cannot-get-android-market-licensing-lvl-working-reliably-almost-always-return

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!