Skip to content

PushManager.checkToken 小米或者华为手机的时候,token为null #1

Description

@zhaozw
private static void checkToken() {
    //default value
    int type = -1;
    String token = null;
    if (OS == Constants.OS_HUAWEI) {
        if (!TextUtils.isEmpty(tokenHuawei)) {
            if (ERROR.equals(tokenHuawei)) {
                // other
                type = Constants.OS_OTHER;
                token = tokenOther;
            } else if (!TextUtils.isEmpty(tokenOther)) {
                // hauwei
                type = Constants.OS_HUAWEI;
                token = tokenHuawei;
            }
        }
    } else if (OS == Constants.OS_MI) {
        if (!TextUtils.isEmpty(tokenMi)) {
            if (ERROR.equals(tokenMi)) {
                // other
                type = Constants.OS_OTHER;
                token = tokenOther;
            } else if (!TextUtils.isEmpty(tokenOther)) {
                // MI
                type = Constants.OS_MI;
                token = tokenMi;
            }
        }
    } else {
        if (!TextUtils.isEmpty(tokenOther)) {
            // other
            type = Constants.OS_OTHER;
            token = tokenOther;
        }
    }
    if ( tokenListeners.size() > 0 && !TextUtils.isEmpty(token) && !ERROR.equals(token)) {

// reportTime--;
for (TokenListener listener : tokenListeners) {
listener.gotToken(type, token);
}
}
}

貌似TextUtils.isEmpty(tokenOther)应该改成TextUtils.isEmpty(tokenMi)和TextUtils.isEmpty(tokenHuawei)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions