Пример #1
0
 private void doCheckNetTask() {
   User user = SPUtil.getDefaultUser(this, null);
   Map<String, Object> taskParams = new HashMap<String, Object>();
   taskParams.put(Task.FAN_ACTIVITY, HomePageActivity.class.getSimpleName());
   taskParams.put(User.PHONENUMBER, user.getPhoneNumber());
   taskParams.put(User.PASSWORD, user.getPassword());
   taskParams.put(Task.FAN_AUTHO_DEVICE_CODE, JPushInterface.getRegistrationID(this));
   taskParams.put(Task.FAN_AUTHO_SYSTEM_TYPE, Task.FAN_AUTHO_SYSTEM_TYPE_ANDROID);
   if (first_time_login) {
     taskParams.put(Task.FAN_AUTHO_BACK_LOGIN, Task.FAN_AUTHO_BACK_LOGIN_NO);
   } else {
     taskParams.put(Task.FAN_AUTHO_BACK_LOGIN, Task.FAN_AUTHO_BACK_LOGIN_YES);
   }
   Task task = new Task(Task.FAN_AUTHO, taskParams);
   IfanService.addTask(task);
 }
Пример #2
0
  private void doCheckEMNetTask() {
    String userId = SPUtil.getDefaultUser(this, null).getId();
    EMChatManager.getInstance()
        .login(
            userId,
            User.EM_PASSWORD,
            new EMCallBack() {
              public void onSuccess() {}

              public void onProgress(int arg0, String arg1) {}

              public void onError(int arg0, String arg1) {
                runOnUiThread(
                    new Runnable() {
                      public void run() {
                        ToastUtil.prompt(HomePageActivity.this, "登录聊天服务器失败");
                      }
                    });
              }
            });
  }
Пример #3
0
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (IntentString.Receiver.NEW_INFO.equals(action)) {
     String type = intent.getStringExtra(IntentString.Push.TYPE);
     if (IntentString.Push.TYPE_FORCE_QUIT.equals(type)) {
       ToastUtil.longPrompt(context, "您的帐号在其它设备上登录,您被强迫下线!");
       IfanService.emptyList();
       SPUtil.saveDefaultUser(context, User.ID, null);
       Intent forceQuitIntent = new Intent(context, AuthoActivity.class);
       forceQuitIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
       context.startActivity(forceQuitIntent);
     } else if (IntentString.Push.TYPE_STATUS_INFO.equals(type)) {
       if (curIndex == INDEX_GROUP) {
         GroupActivity groupActivity =
             (GroupActivity) getLocalActivityManager().getActivity(tabs[INDEX_GROUP]);
         groupActivity.refreshNewInfo();
       }
     } else if (IntentString.Push.TYPE_HAS_MATCH.equals(type)) {
       FindActivity findActivity =
           (FindActivity) getLocalActivityManager().getActivity(tabs[INDEX_FIND]);
       findActivity.doGetMatchTask();
     } else if (IntentString.Push.TYPE_GIRL_LIKE_YOU.equals(type)) {
       FindActivity findActivity =
           (FindActivity) getLocalActivityManager().getActivity(tabs[INDEX_FIND]);
       findActivity.doGetMatchTask();
     } else if (IntentString.Push.TYPE_NEW_FRIEND.equals(type)) {
       Intent nfIntent = new Intent(IntentString.Receiver.NEW_FRIEND);
       sendBroadcast(nfIntent);
     } else if (IntentString.Push.TYPE_BOY_LIKE_YOU.equals(type)) {
       if (curIndex == INDEX_FIND) {
         FindActivity findActivity =
             (FindActivity) getLocalActivityManager().getActivity(tabs[INDEX_FIND]);
         findActivity.refreshNewInfo();
       }
     }
   }
 }