Esempio n. 1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onCreate(savedInstanceState);
   userManager = BmobUserManager.getInstance(this);
   manager = BmobChatManager.getInstance(this);
   mApplication = CustomApplcation.getInstance();
   DisplayMetrics metric = new DisplayMetrics();
   getWindowManager().getDefaultDisplay().getMetrics(metric);
   mScreenWidth = metric.widthPixels;
   mScreenHeight = metric.heightPixels;
 }
Esempio n. 2
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("�û�λ��δ�������仯");
      }
    }
  }