예제 #1
0
  /**
   * 连接融云服务器
   *
   * @param c
   * @param token 用户令牌
   */
  public static void ConnectRongYun(final Context c, String token) {
    RongYunFrindsManager.getInstance(c);
    if (c.getApplicationInfo()
        .packageName
        .equals(App.getCurrentPidName(c.getApplicationContext()))) {
      RongIM.connect(
          token,
          new ConnectCallback() {

            @Override
            public void onTokenIncorrect() {
              // TODO Auto-generated method stub
              Toast.makeText(c.getApplicationContext(), "获取令牌失败", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onError(ErrorCode arg0) {
              // TODO Auto-generated method stub
              Toast.makeText(c.getApplicationContext(), "服务器故障,请稍候重试", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onSuccess(String arg0) {
              // TODO Auto-generated method stub
              Toast.makeText(c.getApplicationContext(), "登录成功", Toast.LENGTH_SHORT).show();
            }
          });
    }
  }
예제 #2
0
  @Override
  public UserInfo getUserInfo(final String uId) {

    list = RongYunFrindsManager.getAllFriends();
    if (list == null) {

    } else {
      for (Friend friend : list) {
        if (friend.getPhone() == uId) {
          info = new UserInfo(friend.getPhone(), friend.getName(), Uri.parse(friend.getImgs()));
        }
      }
    }
    return info;
  }