离线时Android许可证验证库
因此,我使用我的应用程序设置了 Android LVL 以检查许可。这对于测试帐户来说似乎非常有效。问题是,如果我关闭手机互联网连接并尝试运行该应用程序,许可检查将失败并告诉我它未获得许可!
一件事是,为什么它告诉我该应用程序未获得许可,更重要的是,我如何让应用程序“记住”它是否已获得许可。
So, I've setup the Android LVL with my application to check for licensing. This seems to work great with the Test Accounts. The problem is, if I turn the phones internet connection off and try to run the app, the licensing check will fail and tell me it's NOT licensed!
One thing is, why does it tell me the application is NOT licensed and more importantly, how can I have the application 'remember' if it is licensed or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显然,这个问题的答案是许可证在测试时不会被缓存,而是在市场上时会被缓存。我创建了一个小应用程序来测试它并且它有效!
Apparently the answer to this is that the license is not cached when testing, but is when on the market. I created a small app to test this and it works!
抱歉,我也确认飞行模式会导致无法依赖任何缓存。理论上,如果应用程序处于在线状态并在离线之前对许可证服务器执行 ping 操作,那么它可能会起作用。但是,如果手机离线很长一段时间,则没有缓存机制。看看代码就知道了。我针对 android 提交了一个错误:
http://code.google.com/p/android/issues/detail ?id=12978
因为我的 Shout n' Snapshoutnsnap.com 用户已经证实了这种愚蠢的行为。
我在客户端使用两部分挑战制定了解决方法。 EG:
代码在这里:http://code.google.com/p/androidbest/
Sorry but, I too confirm that airplane mode results in a failure to rely on any cache. Theoretically, if the app was online and pinged the license server right before going offline, then it might work. However, if the phone is offline for any significant amount of time, there is no caching mechanism. Just look at the code. I filed a bug against android :
http://code.google.com/p/android/issues/detail?id=12978
Because my users of Shout n' Snap shoutnsnap.com are ALREADY confirming this stupid behavior.
I've made a workaround using a 2 part challenge on the client side. EG:
Code is here: http://code.google.com/p/androidbest/