zoukankan      html  css  js  c++  java
  • 团队冲刺

    第五天

    今天把好友列表写了写

    整体框架差不多了

    不过功能还不好实现

    准备从数据库添加好友到好友列表

    模拟的是qq

     EMOptions options = new EMOptions();
    // 默认添加好友时,是不需要验证的,改成需要验证
    // options.setAcceptInvitationAlways(false);
    // 是否自动将消息附件上传到环信服务器,默认为True是使用环信服务器上传下载,如果设为 false,需要开发者自己处理附件消息的上传和下载
    options.setAutoTransferMessageAttachments(true);
    // 是否自动下载附件类消息的缩略图等,默认为 true 这里和上边这个参数相关联
    options.setAutoDownloadThumbnail(true);

    EMClient.getInstance().init(this, options);
    //在做打包混淆时,关闭debug模式,避免消耗不必要的资源
    EMClient.getInstance().setDebugMode(true);

    /*msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    registerReceiver(msgReceiver, intentFilter);*/


    EMClient.getInstance().chatManager().loadAllConversations();
    EMClient.getInstance().groupManager().loadAllGroups();

    EMClient.getInstance().contactManager().setContactListener(new EMContactListener() {

    //收到请求
    @Override
    public void onContactInvited(String friend_phone, String reason) {
    try {
    EMClient.getInstance().contactManager().acceptInvitation(friend_phone);
    } catch (HyphenateException e) {
    e.printStackTrace();
    }
    }

    //请求已经同意
    @Override
    public void onFriendRequestAccepted(String friend_phone) {

    }

    //请求被拒绝
    @Override
    public void onFriendRequestDeclined(String username) {
    }

    @Override
    public void onContactAdded(String username) {

    }

    @Override
    public void onContactDeleted(String username) {
    //被删除时回调此方法
    }

    });

  • 相关阅读:
    hdu 6702 ^&^ 位运算
    hdu 6709 Fishing Master 贪心
    hdu 6704 K-th occurrence 二分 ST表 后缀数组 主席树
    hdu 1423 Greatest Common Increasing Subsequence 最长公共上升子序列 LCIS
    hdu 5909 Tree Cutting FWT
    luogu P1588 丢失的牛 宽搜
    luogu P1003 铺地毯
    luogu P1104 生日
    luogu P1094 纪念品分组
    luogu P1093 奖学金
  • 原文地址:https://www.cnblogs.com/D10304/p/14914108.html
Copyright © 2011-2022 走看看