许可检查长寿"激活"状态。如何频繁的是太多的用户? [英] Licensing checker longevity of the "activated" status. How frequent is too much for the user?

查看:163
本文介绍了许可检查长寿"激活"状态。如何频繁的是太多的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是一种袖珍指南的一些数据,全年。我假设用户会使用该程序至少一次与上网激活许可证。或者说,至少这是我的Andr​​oid的许可系统是如何工作的理解。我使用ServerManagedPolicy。

是否定期检查许可证?有没有什么办法,我能控制吗?我不希望我的用户是在中间的地方,有一个应用程序已经和previously启动和应用程序1开始周,1月,1年等之后突然限制了应用程序本身,因为的可用性许可证无法验证的再次的。我的应用程序将会在偏僻的地方,与飘忽不定的网络访问使用的人谁就会生活在那里的几个星期,可能几个月(不能想当然所有的时间)。

我觉得我至少应该警告他们,他们将被要求每隔X周来做到这一点。是许可证制度,甚至是严厉的?

我知道我可以用ERROR_CONTACTING_SERVER标志处理这些错误,就LicenseCheckerCallback的的ApplicationError无效。是VT的反应总是一样的(无法在测试帐户/我的帐户测试这一点)?我只是好奇,你们怎么看待这种情况对自己的现实生活中的应用。我失去了一些东西呢?出于某种原因,我感觉我。有没有抓?

//编辑:

下面是code我想现在:

  // ServerManagedPolicy.java
私人无效setValidityTimestamp(字符串validityTimestamp){
    龙lValidityTimestamp;
    尝试 {
        lValidityTimestamp =的Long.parseLong(validityTimestamp);
    }赶上(NumberFormatException异常E){
        //无响应或没有可解析,过期一分钟。
        Log.w(TAG,许可证有效期时间戳(VT)丢失,缓存一分钟);
        lValidityTimestamp = System.currentTimeMillis的()+ MILLIS_PER_MINUTE;
        validityTimestamp = Long.toString(lValidityTimestamp);
    }
    //由我添加 - >

    私有静态长maxLicense = 1000 * 3600 * 24 * 30; //〜大约30天
    私有静态长minLicense = 1000 * 3600 * 24 * 3; //〜大致3天

    长LMAX = System.currentTimeMillis的()+ maxLicense;
    长LMIN = System.currentTimeMillis的()+ minLicense;
    如果((lValidityTimestamp> LMIN)及及(lValidityTimestamp&所述; LMAX)){
        validityTimestamp = Long.toString(LMAX);
    }

    //< ---附加由我

    mValidityTimestamp = lValidityTimestamp;
    米preferences.putString(preF_VALIDITY_TIMESTAMP,validityTimestamp);
}
 

解决方案

只是我的两分钱,你可以定义一段时间,你想查询(可以说3天)。检查许可证后3天内,如果没有网络,继续让用户使用它可以说一个星期最多否则该应用程序将无法充分发挥作用。或者只是保持它充分发挥作用,直到有一次一个连接,然后就可以检查并重置您的时间戳。当你告诉它的许可证检查程序将只检查。

我可以澄清如果需要的话!

好运气

My app is a kind of a pocket guide with some data for the whole year. I'm assuming users will use the program at least once with Internet access to activate the license. Or at least that's my understanding of how the Android licensing system works. I'm using ServerManagedPolicy.

Does it check periodically for the license? Is there any way that I can control this? I don't want my users to be in the middle of nowhere, with an app already and previously activated and suddenly after 1 week, 1 month, 1 year etc. the app starts limiting the usability of the app itself because the license couldn't be verified again. My app is going to be used in remote places with erratic net access (can't be taken for granted all the time) by people who will live there for weeks, maybe months.

I feel I should at least warn them that they will be asked every X weeks to do that. Is the license system even that draconian?

I know I can handle the errors with the ERROR_CONTACTING_SERVER flag, on the applicationError void of LicenseCheckerCallback. Is the "VT" response always the same (can't test this on a test account/my account)? I was just curious about how you guys treat this situation on your own real life apps. Am I missing something here? For some reason I'm feeling I am. Is there any "catch"?

// EDITED:

Here is the code I'm trying right now:

// ServerManagedPolicy.java
private void setValidityTimestamp(String validityTimestamp) {
    Long lValidityTimestamp;
    try {
        lValidityTimestamp = Long.parseLong(validityTimestamp);
    } catch (NumberFormatException e) {
        // No response or not parsable, expire in one minute.
        Log.w(TAG, "License validity timestamp (VT) missing, caching for a minute");
        lValidityTimestamp = System.currentTimeMillis() + MILLIS_PER_MINUTE;
        validityTimestamp = Long.toString(lValidityTimestamp);
    }
    // added by me--->

    private static long maxLicense = 1000 * 3600 * 24 * 30; // ~ roughly 30 days
    private static long minLicense = 1000 * 3600 * 24 * 3;  // ~ roughly 3 days

    long lMax = System.currentTimeMillis() + maxLicense;
    long lMin = System.currentTimeMillis() + minLicense;
    if ((lValidityTimestamp > lMin) && (lValidityTimestamp < lMax)) {
        validityTimestamp = Long.toString(lMax);
    }

    // <--- added by me

    mValidityTimestamp = lValidityTimestamp;
    mPreferences.putString(PREF_VALIDITY_TIMESTAMP, validityTimestamp);
}

解决方案

Just my two cents, you can define a period of time you would like to check (lets say 3 days). Check for the license after 3 days, if there is no internet, continue letting the user use it for lets say another week max or else the app will not be full functioned. Or just keep it full functioned until there is a connection again, then you can check and reset your time stamp. The license checker will only check when you tell it to.

I can clarify if need be!

Good luck

这篇关于许可检查长寿&QUOT;激活&QUOT;状态。如何频繁的是太多的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆