hyphenate_SDK3.0  3.0.1
hyphenatejavaIMSDK
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
com.hyphenate.chat.EMClient Class Reference

Classes

interface  AppStateListener
 
class  MyConnectionListener
 

Public Member Functions

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< EMContactgetRobotsFromServer () throws HyphenateException
 
EMOptions getOptions ()
 
EMChatConfig getChatConfig ()
 

Static Public Member Functions

static EMClient getInstance ()
 

Static Public Attributes

static final String TAG = "EMClient"
 
static final String VERSION = "3.1.2"
 

Detailed Description

IM SDK Client, entrance of SDK, used to login, logout, and get access IM modules, such as

 EMChatManager chatManager = EMClient.getInstance().chatManager();

Member Function Documentation

void com.hyphenate.chat.EMClient.addConnectionListener ( final EMConnectionListener  listener)

add connection listener

Parameters
listener
EMCallManager com.hyphenate.chat.EMClient.callManager ( )

get call manager

Returns
EMCallManager
EMChatManager com.hyphenate.chat.EMClient.chatManager ( )

get chat manager

Returns
EMChatManager
EMChatRoomManager com.hyphenate.chat.EMClient.chatroomManager ( )

get chatroom manager

Returns
EMChatRoomManager
EMContactManager com.hyphenate.chat.EMClient.contactManager ( )

get contact manager

Returns
EMContactManager
void com.hyphenate.chat.EMClient.createAccount ( String  username,
String  password 
) throws HyphenateException

create an IM account on server

Parameters
username
password
EMChatConfig com.hyphenate.chat.EMClient.getChatConfig ( )
String com.hyphenate.chat.EMClient.getCurrentUser ( )

get current logged in user id

Returns
current logged in user
EMOptions com.hyphenate.chat.EMClient.getOptions ( )

get EMOptions

List<EMContact> com.hyphenate.chat.EMClient.getRobotsFromServer ( ) throws HyphenateException

get robot list

Returns
list of EMContact
Exceptions
hyphenateException
EMGroupManager com.hyphenate.chat.EMClient.groupManager ( )

get group manager

Returns
EMGroupManager
void com.hyphenate.chat.EMClient.init ( Context  context,
EMOptions  options 
)

initialize the SDK

boolean com.hyphenate.chat.EMClient.isConnected ( )

check if connected to server.

Returns
boolean com.hyphenate.chat.EMClient.isLoggedInBefore ( )

used to check if user has been logged in before and did not logout if you need check if connected to server, please use isConnected()

if(EMClient.getInstance().isLoggedInBefore()){
    // enter main activity
}else{
    // enter login activity
}
Returns
void com.hyphenate.chat.EMClient.login ( String  id,
String  password,
final EMCallBack  callback 
)

login to IM server suggest to not login again until last login callback returns

Parameters
idunique IM Login ID
passwordpassword for this IM ID
callbacklogin callback
Exceptions
throwruntime exception if callback is null or id/password is empty
int com.hyphenate.chat.EMClient.logout ( boolean  unbindToken)

logout

Parameters
unbindTokenwhether unbind token
void com.hyphenate.chat.EMClient.logout ( final boolean  unbindToken,
final EMCallBack  callback 
)

logout hyphenate IM server synchronously

Parameters
unbindTokenwhether unbind token
callbackEMCallback
void com.hyphenate.chat.EMClient.removeConnectionListener ( final EMConnectionListener  listener)

remove connection listener

Parameters
listener
void com.hyphenate.chat.EMClient.setDebugMode ( boolean  debugMode)

SDK will out put debug info if debugMode = true

Parameters
debugMode
boolean com.hyphenate.chat.EMClient.updateCurrentUserNick ( String  nickname)

This method can be used to set a nickname, the nickname will be used to show for APNS on iOS.

Parameters
nickname

The documentation for this class was generated from the following file: