注册

有添加好友没反应的吗??进来交流下!

添加好友监听没反应啊?

/**
* add frd
* @param view
*/
public void findFrd(View view){
if(!TextUtils.isEmpty(et_find.getText().toString().trim())){
try {
EMContactManager.getInstance().addContact(et_find.getText().toString().trim(), "add a friends?");
Toast.makeText(this, "add frd", Toast.LENGTH_SHORT).show();
} catch (EaseMobException e) {
e.printStackTrace();
Toast.makeText(this, "add frd fail", Toast.LENGTH_SHORT).show();
Log.d("mianAct", "add frd fail");
}
}
}




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_find = (EditText) findViewById(R.id.et_find);
EMContactManager.getInstance().setContactListener(new MyContactLis());
EMChatManager.getInstance().addConnectionListener(new MyConnecLis());
EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeLis());
EMChat.getInstance().setAppInited();//init finish
Toast.makeText(this, "init lis finish", Toast.LENGTH_SHORT).show();
}



private class MyContactLis implements EMContactListener {

@Override
public void onContactAdded(List arg0) {

}

@Override
public void onContactAgreed(String username) {

}

@Override
public void onContactDeleted(List arg0) {

}

@Override
public void onContactInvited(String username, String reason) {
Log.i("contactlis", "get a contact invite from"+username);
Toast.makeText(getApplicationContext(), "get a contact invite from" + username, Toast.LENGTH_SHORT).show();
}

@Override
public void onContactRefused(String username) {

}
}


已邀请:

lizg - ……

你添加好友发送的请求成功了么? 广播监听到了么?
请求没报异常,应该是成功了啊,就是广播监听不到啊。。怎么搞

lizg - ……

http://www.easemob.com/docs/android/buddy/#section-1 你看看
你帮我看下我上面贴的代码,哪里有问题吗??
> forum.php?mod=redirect&goto=findpost&pid=2718&ptid=1194
http://www.easemob.com/docs/android/buddy/#section-1 你看看


你帮我看下我上面贴的代码,哪里有问题吗??还是缺了什么东西,初始化我已经在application中初始化了
> forum.php?mod=redirect&goto=findpost&pid=2720&ptid=1194
你帮我看下我上面贴的代码,哪里有问题吗??还是缺了什么东西,初始化我已经在application中初始化了 ...


这看起来没什么问题,我让你用demo试下,有没有试试
> forum.php?mod=redirect&goto=findpost&pid=2722&ptid=1194
这看起来没什么问题,我让你用demo试下,有没有试试


你们都的Demo到是没问题,但是我写的Demo来测试就是不行啊

lizg - ……

你看看代码,对比你哪里少写了

要回复问题请先登录注册