离线时Android许可证验证库

发布于 2024-09-26 22:17:15 字数 161 浏览 10 评论 0原文

因此,我使用我的应用程序设置了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画中仙 2024-10-03 22:17:15

显然,这个问题的答案是许可证在测试时不会被缓存,而是在市场上时会被缓存。我创建了一个小应用程序来测试它并且它有效!

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!

安静 2024-10-03 22:17:15

抱歉,我也确认飞行模式会导致无法依赖任何缓存。理论上,如果应用程序处于在线状态并在离线之前对许可证服务器执行 ping 操作,那么它可能会起作用。但是,如果手机离线很长一段时间,则没有缓存机制。看看代码就知道了。我针对 android 提交了一个错误:
http://code.google.com/p/android/issues/detail ?id=12978

因为我的 Shout n' Snapshoutnsnap.com 用户已经证实了这种愚蠢的行为。

我在客户端使用两部分挑战制定了解决方法。 EG:


IF LICENSED:
  PERSIST random key as LK
  PERSIST obfuscated random key as OLK
ELSE:
  if (deobfuscate(OLK) == LK) 
    GRANT ACCESS
  ELSE:
    GET LOST 

代码在这里: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:


IF LICENSED:
  PERSIST random key as LK
  PERSIST obfuscated random key as OLK
ELSE:
  if (deobfuscate(OLK) == LK) 
    GRANT ACCESS
  ELSE:
    GET LOST 

Code is here: http://code.google.com/p/androidbest/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文