private void doExitTask() { finish(); ShareSDK.stopSDK(this); IfanService.emptyList(); Intent intent = new Intent(this, IfanService.class); stopService(intent); android.os.Process.killProcess(android.os.Process.myPid()); /* Map<String, Object> taskParams = new HashMap<String, Object>(); taskParams.put(Task.FAN_ACTIVITY, HomePageActivity.class.getSimpleName()); Task task = new Task(Task.FAN_EXIT, taskParams); IfanService.addTask(task); */ }
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(); } } } }