Exemplo n.º 1
0
  private void initData() {
    this.initUserData();
    // this.initChatContent();
    mBaiduPushServer = new BaiduPush(BaiduPush.HTTP_METHOD_POST, SECRIT_KEY, API_KEY);
    // ²»×ª»»Ã»ÓÐ @Expose ×¢½âµÄ×Ö¶Î
    mGson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
    mSpUtil = new SharePreferenceUtil(this, SP_FILE_NAME);
    mUserDB = new UserDB(this);
    mMsgDB = new MessageDB(this);
    mRecentDB = new RecentDB(this);

    mMediaPlayer = MediaPlayer.create(this, R.raw.office);
    mNotificationManager =
        (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE);

    if (mSpUtil.getId() == 0) {
      PushMessageReceiver.ehList.add(this); // ¼àÌýÍÆË͵ÄÏûÏ¢
      index = 1; // ÀÏʦ
      initFriend();
      User user = getCurrentUser();
      mSpUtil.setId(user.getId());
      mSpUtil.setRole(user.getRole());
      mSpUtil.setHeadIcon(user.getHeadIcon());
      mSpUtil.setNick(user.getNick());
      // mSpUtil.setTag(SexAdapter.SEXS[mSexWheel.getCurrentItem()]);

    }
    if (TextUtils.isEmpty(mSpUtil.getUserId()))
      PushManager.startWork(
          getApplicationContext(), PushConstants.LOGIN_TYPE_API_KEY, PushApplication.API_KEY);
    int id = mSpUtil.getId();
    int role = mSpUtil.getRole();
    String userId = mSpUtil.getUserId();
    String name = mSpUtil.getNick();
    String channelId = mSpUtil.getChannelId();
    mUserList = mUserDB.getUser();
  }