@Override public void login(String app_user_id) { CdSharedPreferencesUtils.put(mContext, CdSharedPreferencesUtils.KEY_APP_USER_ID, app_user_id); String token = CdSharedPreferencesUtils.getTokenSingle(mContext, "" + PushManager.PHONE_TYPE_MIUI); // 登入时, 还未获取到token值, if (TextUtils.isEmpty(token)) { // 请求一次token, 请求成功,会再次触发上传token MiPushClient.registerPush(mContext, APP_ID, APP_KEY); } }
@Override public void init() { // 小米4 token if (CdTools.isMainProcess(mContext)) { String appUserId = (String) CdSharedPreferencesUtils.get(mContext, CdSharedPreferencesUtils.KEY_APP_USER_ID, ""); String uploadToken = CdSharedPreferencesUtils.getTokenSingle(mContext, "" + PushManager.PHONE_TYPE_MIUI); if (TextUtils.isEmpty(uploadToken)) { // 没有上传过, 才注册上传token MiPushClient.registerPush(mContext, APP_ID, APP_KEY); } CdLogUtils.v("miuiPush", " init(). token " + uploadToken); Logger.setLogger(mContext, newLogger); } }