測試 Android LVL,許可證檢查總是失敗,沒有網絡 (Testing Android LVL, license check always fails with no network)


問題描述

測試 Android LVL,許可證檢查總是失敗,沒有網絡 (Testing Android LVL, license check always fails with no network)

i'm testing the android license verification library (LVL) in my app. my implementation is currently bone‑stock. i haven't modified the library, and i'm using the ServerManagedPolicy. i have my developer account set to return LICENSED all the time. i'm testing on my physical device, and am signed in on the device with my developer account. a version of my app exists on the android market, but it does not have the LVL in it yet. my app checks the license at startup. 

so far, it seems to work fine, with one exception. when the app attempts to check the license when there is no network connectivity (airplane mode), the license check always fails. my understanding is that with the ServerManagedPolicy, the license response is supposed to be cached, so that one license check failure isn't going to disable the app. is this incorrect?

i know i could check for network connectivity before checking the license, and then decide for myself how many failures to tolerate, but i thought that the ServerManagedPolicy is supposed to handle all that automatically.

‑‑‑‑‑

參考解法

方法 1:

There are two ways to check for LVL:

  1. Every time (StrictPolicy)
  2. Occasionally with expiration (ServerManagedPolicy)

I recommend you go with ServerManagedPolicy; I expect you are using StrictPolicy.  Also, you may want to simply check for connectivity and allow access depending on what your app is and how it works.

Another possibility to keep in mind is that ServerManagedPolicy only caches for a short period of time in test scenarios.  Once you deploy you may be fine.

(by Ben HKeith Adler)

參考文件

  1. Testing Android LVL, license check always fails with no network (CC BY‑SA 3.0/4.0)

#java #android-lvl #Android






相關問題

電子郵件地址中帶有 + 字符的 Java 郵件 (Java mail with + character in email address)

如何快速原型化 Java 代碼? (How to quickly prototype Java code?)

如何使用 Maven 在目標(SVN-)服務器上創建 Javadoc? (How to create Javadoc on the target (SVN-) server using Maven?)

為什麼檢查二叉樹有效性的解決方案不起作用? (Why the solution for checking the validity of binary tree is not working?)

Selenium webdriver通過第一個數字找到texy (Selenium webdriver find texy by first digits)

setOnClickListener 沒有在圖像視圖上被調用 (setOnClickListener is not getting called on image view)

繪製多邊形:找不到錯誤 (Drawing Polygon : unable to find error)

半透明 JButton:對像出現在背景中 (Semi-Transparent JButton: Objects appear in Background)

比較同一數組的元素 (Compare elements of the same array)

Java 屏幕截圖小程序 (Java screen capture applet)

Minecraft 1.8.9 Forge Modding 的Java 開發工具包,需要什麼JDK/JRE,代碼是否正確? (Java Development Kit with Minecraft 1.8.9 Forge Modding, What JDK/JRE Is Needed, Is Code Correct?)

java while (resultset.next()) 不返回同一列中的所有數據 (java while (resultset.next()) does not return all data in the same column)







留言討論