Exemplo n.º 1
0
 public void checkLogin() {
   BmobUserManager userManager = BmobUserManager.getInstance(this);
   if (userManager.getCurrentUser() == null) {
     ShowToast("ÄúµÄÕ˺ÅÒÑÔÚÆäËûÉ豸ÉϵǼ!");
     startActivity(new Intent(this, LoginActivity.class));
     finish();
   }
 }
Exemplo n.º 2
0
 public void checkLogin() {
   // 获取当前缓存用户
   BmobUserManager userManager = BmobUserManager.getInstance(this);
   // 如果当前用户为NULL
   if (userManager.getCurrentUser() == null) {
     ShowToast("您的账号已在其他设备上登录!");
     startActivity(new Intent(this, LoginActivity.class));
     finish();
   }
 }
Exemplo n.º 3
0
  /**
   * 更新用户的经纬度信息 @Title: uploadLocation @Description: TODO
   *
   * @param
   * @return void
   * @throws
   */
  public void updateUserLocation() {
    if (CustomApplcation.lastPoint != null) {
      String saveLatitude = mApplication.getLatitude();
      String saveLongtitude = mApplication.getLongtitude();
      String newLat = String.valueOf(CustomApplcation.lastPoint.getLatitude());
      String newLong = String.valueOf(CustomApplcation.lastPoint.getLongitude());
      //			ShowLog("saveLatitude ="+saveLatitude+",saveLongtitude = "+saveLongtitude);
      //			ShowLog("newLat ="+newLat+",newLong = "+newLong);
      if (!saveLatitude.equals(newLat)
          || !saveLongtitude.equals(newLong)) { // 只有位置有变化就更新当前位置,达到实时更新的目的
        User u = (User) userManager.getCurrentUser(User.class);
        final User user = new User();
        user.setLocation(CustomApplcation.lastPoint);
        user.setObjectId(u.getObjectId());
        user.update(
            this,
            new UpdateListener() {
              @Override
              public void onSuccess() {
                // TODO Auto-generated method stub
                CustomApplcation.getInstance()
                    .setLatitude(String.valueOf(user.getLocation().getLatitude()));
                CustomApplcation.getInstance()
                    .setLongtitude(String.valueOf(user.getLocation().getLongitude()));
                //						ShowLog("经纬度更新成功");
              }

              @Override
              public void onFailure(int code, String msg) {
                // TODO Auto-generated method stub
                //						ShowLog("经纬度更新 失败:"+msg);
              }
            });
      } else {
        //				ShowLog("用户位置未发生过变化");
      }
    }
  }
Exemplo n.º 4
0
  /**
   * �����û��ľ�γ����Ϣ @Title: uploadLocation @Description: TODO
   *
   * @param
   * @return void
   * @throws
   */
  public void updateUserLocation() {
    if (CustomApplcation.lastPoint != null) {
      String saveLatitude = mApplication.getLatitude();
      String saveLongtitude = mApplication.getLongtitude();
      String newLat = String.valueOf(CustomApplcation.lastPoint.getLatitude());
      String newLong = String.valueOf(CustomApplcation.lastPoint.getLongitude());
      //			ShowLog("saveLatitude ="+saveLatitude+",saveLongtitude = "+saveLongtitude);
      //			ShowLog("newLat ="+newLat+",newLong = "+newLong);
      if (!saveLatitude.equals(newLat)
          || !saveLongtitude.equals(newLong)) { // ֻ��λ���б仯�͸��µ�ǰλ�ã��ﵽʵʱ���µ�Ŀ��
        final User user = (User) userManager.getCurrentUser(User.class);
        user.setLocation(CustomApplcation.lastPoint);
        user.update(
            this,
            new UpdateListener() {
              @Override
              public void onSuccess() {
                // TODO Auto-generated method stub
                CustomApplcation.getInstance()
                    .setLatitude(String.valueOf(user.getLocation().getLatitude()));
                CustomApplcation.getInstance()
                    .setLongtitude(String.valueOf(user.getLocation().getLongitude()));
                //						ShowLog("��γ�ȸ��³ɹ�");
              }

              @Override
              public void onFailure(int code, String msg) {
                // TODO Auto-generated method stub
                //						ShowLog("��γ�ȸ��� ʧ��:"+msg);
              }
            });
      } else {
        //				ShowLog("�û�λ��δ�������仯");
      }
    }
  }