Пример #1
0
  @Override
  public boolean handleMessage(Message msg) {
    switch (msg.what) {
      case Requester.RESPONSE_TYPE_AUTO_LOGIN:
        autoLoginResponse alogin = (autoLoginResponse) msg.obj;
        if (alogin != null) {
          if (alogin.status.equals("0") || alogin.status.equals("0000")) { // 自动登录成功
            AccountInfo acc = new AccountInfo();
            acc.setIsregistration(alogin.isregistration);
            acc.setFlowcoins(alogin.flowcoins);
            acc.setMakeflow(alogin.makeflow);
            acc.setUseflow(alogin.useflow);
            acc.setUserid(alogin.userid);
            acc.setTel(alogin.tel);
            acc.setNickname(alogin.nickname);
            accountInfoDao.deleteAll();
            accountInfoDao.insertOrReplace(acc);
            if (alogin.tel != null && !alogin.tel.equals("")) {
              WeFlowApplication.getAppInstance().addJPushTag(alogin.tel);
            }
            handler.postDelayed(runnable, INTV_TIME);
          } else {
            PromptDialog.Alert(WelcomePageActivity.class, "登录失败,请重新登录");
            Intent i = new Intent(this, LoginActivity.class);
            if (aiList != null && aiList.size() > 0) {
              i.putExtra("tel", aiList.get(0).getTel());
            }
            startActivity(i);
            this.finish();
          }
        } else {
          PromptDialog.Alert(WelcomePageActivity.class, "您的网络不给力啊!");
          handler.postDelayed(runnable, INTV_TIME);
        }
        break;
        /*		case Requester.RESPONSE_TYPE_UPDATE:
        			if (msg.obj != null) {
        				final UpdateResp resp = (UpdateResp) msg.obj;
        				if (Requester.isSuccessed(resp.status)) {
        					try {
        						resp.type = "2";
        						//已经最新
        						if ("0".equals(resp.type)) {
        //							PromptDialog.Dialog(this, "版本升级", "当前已经是最新版本", "确定");
        							//普通升级
        						} else if ("1".equals(resp.type)) {
        							PromptDialog.Dialog(this, true, true, false, "版本升级", resp.description, "下载", "取消", new OnClickListener() {

        								@Override
        								public void onClick(DialogInterface dialog, int which) {
        									// TODO Auto-generated method stub
        									DownloadManager.getInstance().addDownloadTask(resp.filepath, "0", resp.version, "", "",  DownloadType.APP, "", "","","com.etoc.weflow");
        								}
        							}, null, false, null);
        							//强制升级
        						} else if ("2".equals(resp.type)){
        							PromptDialog.Dialog(this, false, false, false, "版本升级", resp.description, "下载", "取消", new OnClickListener() {

        								@Override
        								public void onClick(DialogInterface dialog, int which) {
        									// TODO Auto-generated method stub
        									DownloadManager.getInstance().addDownloadTask(resp.filepath, "0", resp.version, "", "",  DownloadType.APP, "", "","","com.etoc.weflow");
        								}
        							}, null, false, null);
        						}
        					} catch(Exception e) {
        						e.printStackTrace();
        					}
        				}
        			}
        			break;*/
    }
    return false;
  }