|
hyphenate_SDK3.0
3.1.4
hyphenatejavaIMSDK
|
类 | |
| interface | AppStateListener |
| class | MyConnectionListener |
Public 成员函数 | |
| void | init (Context context, EMOptions options) |
| void | createAccount (String username, String password) throws HyphenateException |
| void | login (String id, String password, final EMCallBack callback) |
| int | logout (boolean unbindToken) |
| void | logout (final boolean unbindToken, final EMCallBack callback) |
| void | addConnectionListener (final EMConnectionListener listener) |
| void | removeConnectionListener (final EMConnectionListener listener) |
| EMGroupManager | groupManager () |
| EMChatRoomManager | chatroomManager () |
| EMChatManager | chatManager () |
| EMContactManager | contactManager () |
| EMCallManager | callManager () |
| Context | getContext () |
| String | getCurrentUser () |
| boolean | isLoggedInBefore () |
| boolean | isConnected () |
| void | setDebugMode (boolean debugMode) |
| boolean | updateCurrentUserNick (String nickname) |
| void | uploadLog (EMCallBack callback) |
| List< EMContact > | getRobotsFromServer () throws HyphenateException |
| EMOptions | getOptions () |
| EMChatConfig | getChatConfig () |
静态 Public 成员函数 | |
| static EMClient | getInstance () |
静态 Public 属性 | |
| static final String | TAG = "EMClient" |
| static final String | VERSION = "3.1.4" |
IM SDK的入口,负责登录退出及连接管理等,由此可以获得其他模块的入口
EMChatManager chatManager = EMClient.getInstance().chatManager();
| void com.hyphenate.chat.EMClient.addConnectionListener | ( | final EMConnectionListener | listener | ) |
添加EMConnectionListener
| listener |
| EMCallManager com.hyphenate.chat.EMClient.callManager | ( | ) |
获取EMCallManager
| EMChatManager com.hyphenate.chat.EMClient.chatManager | ( | ) |
获取EMChatManager
| EMChatRoomManager com.hyphenate.chat.EMClient.chatroomManager | ( | ) |
获取EMChatRoomManager
| EMContactManager com.hyphenate.chat.EMClient.contactManager | ( | ) |
获取EMContactManager
| void com.hyphenate.chat.EMClient.createAccount | ( | String | username, |
| String | password | ||
| ) | throws HyphenateException |
创建账号
| username | |
| password |
| EMChatConfig com.hyphenate.chat.EMClient.getChatConfig | ( | ) |
获取EMChatConfig
| String com.hyphenate.chat.EMClient.getCurrentUser | ( | ) |
获取当前登录用户的用户名
| EMOptions com.hyphenate.chat.EMClient.getOptions | ( | ) |
获取EMOptions
| List<EMContact> com.hyphenate.chat.EMClient.getRobotsFromServer | ( | ) | throws HyphenateException |
| EMGroupManager com.hyphenate.chat.EMClient.groupManager | ( | ) |
获取EMGroupManager
| void com.hyphenate.chat.EMClient.init | ( | Context | context, |
| EMOptions | options | ||
| ) |
初始化SDK
| boolean com.hyphenate.chat.EMClient.isConnected | ( | ) |
检查是否连接到聊天服务器
| boolean com.hyphenate.chat.EMClient.isLoggedInBefore | ( | ) |
返回是否登录过 登录成功过没调logout方法,这个方法的返回值一直是true 如果需要判断当前是否连接到服务器,请使用isConnected()方法
if(EMClient.getInstance().isLoggedInBefore()){ // enter main activity }else{ // enter login activity }
| void com.hyphenate.chat.EMClient.login | ( | String | id, |
| String | password, | ||
| final EMCallBack | callback | ||
| ) |
登录IM服务器
| id | 用户id |
| password | 用户密码 |
| callback | EMCallback回调函数 |
| 如果callback或者id,password为空会抛出异常 |
| int com.hyphenate.chat.EMClient.logout | ( | boolean | unbindToken | ) |
退出
| unbindToken | 是否解绑token |
| void com.hyphenate.chat.EMClient.logout | ( | final boolean | unbindToken, |
| final EMCallBack | callback | ||
| ) |
异步登出聊天服务器
| unbindToken | 是否解绑token |
| callback | EMCallback回调 |
| void com.hyphenate.chat.EMClient.removeConnectionListener | ( | final EMConnectionListener | listener | ) |
删除EMConnectionListener
| listener |
| void com.hyphenate.chat.EMClient.setDebugMode | ( | boolean | debugMode | ) |
debugMode == true 时,sdk 会在log里输出调试信息
| debugMode |
| boolean com.hyphenate.chat.EMClient.updateCurrentUserNick | ( | String | nickname | ) |
更新当前用户的nickname
此方法主要为了在苹果推送时能够推送nick而不是userid 一般可以在登陆成功后从自己服务器获取到个人信息,然后拿到nick更新到环信服务器 并且,在个人信息中如果更改个人的昵称,也要把环信服务器更新下nickname 防止显示差异
| nickname | 昵称 |
1.8.9.1