本文整理汇总了Java中com.easemob.EMError类的典型用法代码示例。如果您正苦于以下问题:Java EMError类的具体用法?Java EMError怎么用?Java EMError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMError类属于com.easemob包,在下文中一共展示了EMError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: stopRecoding
import com.easemob.EMError; //导入依赖的package包/类
public int stopRecoding() {
if(recorder != null){
isRecording = false;
recorder.stop();
recorder.release();
recorder = null;
if(file == null || !file.exists() || !file.isFile()){
return EMError.INVALID_FILE;
}
if (file.length() == 0) {
file.delete();
return EMError.INVALID_FILE;
}
int seconds = (int) (new Date().getTime() - startTime) / 1000;
EMLog.d("voice", "voice recording finished. seconds:" + seconds + " file length:" + file.length());
return seconds;
}
return 0;
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:21,代码来源:EaseVoiceRecorder.java
示例2: updateView
import com.easemob.EMError; //导入依赖的package包/类
protected void updateView() {
activity.runOnUiThread(new Runnable() {
public void run() {
if (message.status == EMMessage.Status.FAIL) {
if (message.getError() == EMError.MESSAGE_SEND_INVALID_CONTENT) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), 0).show();
} else if (message.getError() == EMError.MESSAGE_SEND_NOT_IN_THE_GROUP) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_not_in_the_group), 0).show();
} else {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show();
}
}
onUpdateView();
}
});
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:20,代码来源:EaseChatRow.java
示例3: updateView
import com.easemob.EMError; //导入依赖的package包/类
protected void updateView() {
activity.runOnUiThread(new Runnable() {
public void run() {
if (message.status == EMMessage.Status.FAIL) {
if (message.getError() == EMError.MESSAGE_SEND_INVALID_CONTENT) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), 0).show();
} else if (message.getError() == EMError.MESSAGE_SEND_NOT_IN_THE_GROUP) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_not_in_the_group), 0).show();
} else if (message.getError() == EMError.MESSAGE_SEND_IN_BLACKLIST) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_in_blacklist), 0).show();
} else {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show();
}
}
onUpdateView();
}
});
}
开发者ID:easemob,项目名称:easeui,代码行数:22,代码来源:EaseChatRow.java
示例4: initListener
import com.easemob.EMError; //导入依赖的package包/类
/**
* init HuanXin listeners
*/
protected void initListener(){
Log.d(TAG, "init listener");
// create the global connection listener
connectionListener = new EMConnectionListener() {
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED) {
onCurrentAccountRemoved();
}else if (error == EMError.CONNECTION_CONFLICT) {
onConnectionConflict();
}else{
onConnectionDisconnected(error);
}
}
@Override
public void onConnected() {
onConnectionConnected();
}
};
//注册连接监听
EMChatManager.getInstance().addConnectionListener(connectionListener);
}
开发者ID:Owater,项目名称:school_shop,代码行数:29,代码来源:HXSDKHelper.java
示例5: onDisconnected
import com.easemob.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(final int error) {
final String st1 = getResources().getString(R.string.can_not_connect_chat_server_connection);
final String st2 = getResources().getString(R.string.the_current_network);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (error == EMError.USER_REMOVED) {
// 显示帐号已经被移除
showAccountRemovedDialog();
} else if (error == EMError.CONNECTION_CONFLICT) {
// 显示帐号在其他设备登陆dialog
showConflictDialog();
} else {
chatHistoryFragment.errorItem.setVisibility(View.VISIBLE);
if (NetUtils.hasNetwork(EMChatMainActivity.this))
chatHistoryFragment.errorText.setText(st1);
else
chatHistoryFragment.errorText.setText(st2);
}
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:27,代码来源:EMChatMainActivity.java
示例6: stopRecoding
import com.easemob.EMError; //导入依赖的package包/类
public int stopRecoding() {
if (recorder != null) {
isRecording = false;
recorder.stop();
recorder.release();
recorder = null;
if (file == null || !file.exists() || !file.isFile()) {
return EMError.INVALID_FILE;
}
if (file.length() == 0) {
file.delete();
return EMError.INVALID_FILE;
}
int seconds = (int) (new Date().getTime() - startTime) / 1000;
EMLog.d("voice", "voice recording finished. seconds:" + seconds + " file length:" + file.length());
return seconds;
}
return 0;
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:21,代码来源:EaseVoiceRecorder.java
示例7: updateView
import com.easemob.EMError; //导入依赖的package包/类
protected void updateView() {
activity.runOnUiThread(new Runnable() {
public void run() {
if (message.status == EMMessage.Status.FAIL) {
if (message.getError() == EMError.MESSAGE_SEND_INVALID_CONTENT) {
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), 0).show();
} else if (message.getError() == EMError.MESSAGE_SEND_NOT_IN_THE_GROUP) {
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_not_in_the_group), 0).show();
} else {
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show();
}
}
onUpdateView();
}
});
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:20,代码来源:EaseChatRow.java
示例8: onDisconnected
import com.easemob.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.CONNECTION_CONFLICT) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:9,代码来源:EaseConversationListFragment.java
示例9: onDisconnected
import com.easemob.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.CONNECTION_CONFLICT) {
isConflict = true;
} else {
getActivity().runOnUiThread(new Runnable() {
public void run() {
onConnectionDisconnected();
}
});
}
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:14,代码来源:EaseContactListFragment.java
示例10: onDisconnected
import com.easemob.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.CONNECTION_CONFLICT) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
开发者ID:easemob,项目名称:easeui,代码行数:9,代码来源:EaseConversationListFragment.java
示例11: onDisconnected
import com.easemob.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.CONNECTION_CONFLICT) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:9,代码来源:EaseConversationListFragment.java
示例12: updateSendedView
import com.easemob.EMError; //导入依赖的package包/类
/**
* 更新ui上消息发送状态
*
* @param message
* @param holder
*/
private void updateSendedView(final EMMessage message, final ViewHolder holder) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// send success
if (message.getType() == EMMessage.Type.VIDEO) {
holder.tv.setVisibility(View.GONE);
}
EMLog.d(TAG, "message status : " + message.status);
if (message.status == EMMessage.Status.SUCCESS) {
// if (message.getType() == EMMessage.Type.FILE) {
// holder.pb.setVisibility(View.INVISIBLE);
// holder.staus_iv.setVisibility(View.INVISIBLE);
// } else {
// holder.pb.setVisibility(View.GONE);
// holder.staus_iv.setVisibility(View.GONE);
// }
} else if (message.status == EMMessage.Status.FAIL) {
// if (message.getType() == EMMessage.Type.FILE) {
// holder.pb.setVisibility(View.INVISIBLE);
// } else {
// holder.pb.setVisibility(View.GONE);
// }
// holder.staus_iv.setVisibility(View.VISIBLE);
if(message.getError() == EMError.MESSAGE_SEND_INVALID_CONTENT){
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), Toast.LENGTH_SHORT)
.show();
}else if(message.getError() == EMError.MESSAGE_SEND_NOT_IN_THE_GROUP){
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_not_in_the_group), Toast.LENGTH_SHORT)
.show();
}else{
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), Toast.LENGTH_SHORT)
.show();
}
}
notifyDataSetChanged();
}
});
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:49,代码来源:MessageAdapter.java
示例13: setGlobalListeners
import com.easemob.EMError; //导入依赖的package包/类
/**
* 设置全局事件监听
*/
protected void setGlobalListeners(){
syncGroupsListeners = new ArrayList<DataSyncListener>();
syncContactsListeners = new ArrayList<DataSyncListener>();
syncBlackListListeners = new ArrayList<DataSyncListener>();
isGroupsSyncedWithServer = demoModel.isGroupsSynced();
isContactsSyncedWithServer = demoModel.isContactSynced();
isBlackListSyncedWithServer = demoModel.isBacklistSynced();
// create the global connection listener
connectionListener = new EMConnectionListener() {
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED) {
onCurrentAccountRemoved();
}else if (error == EMError.CONNECTION_CONFLICT) {
onConnectionConflict();
}
}
@Override
public void onConnected() {
// in case group and contact were already synced, we supposed to notify sdk we are ready to receive the events
if(isGroupsSyncedWithServer && isContactsSyncedWithServer){
new Thread(){
@Override
public void run(){
DemoHelper.getInstance().notifyForRecevingEvents();
}
}.start();
}else{
if(!isGroupsSyncedWithServer){
asyncFetchGroupsFromServer(null);
}
if(!isContactsSyncedWithServer){
asyncFetchContactsFromServer(null);
}
if(!isBlackListSyncedWithServer){
asyncFetchBlackListFromServer(null);
}
}
// 当连接到服务器之后,这里开始检查是否有没有发送的ack回执消息,
EaseACKUtil.getInstance(appContext).checkACKData();
}
};
IntentFilter callFilter = new IntentFilter(EMChatManager.getInstance().getIncomingCallBroadcastAction());
if(callReceiver == null){
callReceiver = new CallReceiver();
}
//注册通话广播接收者
appContext.registerReceiver(callReceiver, callFilter);
//注册连接监听
EMChatManager.getInstance().addConnectionListener(connectionListener);
//注册群组和联系人监听
registerGroupAndContactListener();
//注册消息事件监听
registerEventListener();
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:70,代码来源:DemoHelper.java
示例14: searchGroup
import com.easemob.EMError; //导入依赖的package包/类
/**
* 搜索
* @param v
*/
public void searchGroup(View v){
if(TextUtils.isEmpty(idET.getText())){
return;
}
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(getResources().getString(R.string.searching));
pd.setCancelable(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
searchedGroup = EMGroupManager.getInstance().getGroupFromServer(idET.getText().toString());
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
containerLayout.setVisibility(View.VISIBLE);
nameText.setText(searchedGroup.getGroupName());
}
});
} catch (final EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
searchedGroup = null;
containerLayout.setVisibility(View.GONE);
if(e.getErrorCode() == EMError.GROUP_NOT_EXIST){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_not_existed), 0).show();
}else{
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_search_failed) + " : " + getString(R.string.connect_failuer_toast), 0).show();
}
}
});
}
}
}).start();
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:47,代码来源:PublicGroupsSeachActivity.java
示例15: register
import com.easemob.EMError; //导入依赖的package包/类
/**
* 注册
*
* @param view
*/
public void register(View view) {
final String username = userNameEditText.getText().toString().trim();
final String pwd = passwordEditText.getText().toString().trim();
String confirm_pwd = confirmPwdEditText.getText().toString().trim();
if (TextUtils.isEmpty(username)) {
Toast.makeText(this, getResources().getString(R.string.User_name_cannot_be_empty), Toast.LENGTH_SHORT).show();
userNameEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(pwd)) {
Toast.makeText(this, getResources().getString(R.string.Password_cannot_be_empty), Toast.LENGTH_SHORT).show();
passwordEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(confirm_pwd)) {
Toast.makeText(this, getResources().getString(R.string.Confirm_password_cannot_be_empty), Toast.LENGTH_SHORT).show();
confirmPwdEditText.requestFocus();
return;
} else if (!pwd.equals(confirm_pwd)) {
Toast.makeText(this, getResources().getString(R.string.Two_input_password), Toast.LENGTH_SHORT).show();
return;
}
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(getResources().getString(R.string.Is_the_registered));
pd.show();
new Thread(new Runnable() {
public void run() {
try {
// 调用sdk注册方法
EMChatManager.getInstance().createAccountOnServer(username, pwd);
runOnUiThread(new Runnable() {
public void run() {
if (!RegisterActivity.this.isFinishing())
pd.dismiss();
// 保存用户名
DemoHelper.getInstance().setCurrentUserName(username);
Toast.makeText(getApplicationContext(), getResources().getString(R.string.Registered_successfully), 0).show();
finish();
}
});
} catch (final EaseMobException e) {
runOnUiThread(new Runnable() {
public void run() {
if (!RegisterActivity.this.isFinishing())
pd.dismiss();
int errorCode=e.getErrorCode();
if(errorCode==EMError.NONETWORK_ERROR){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.network_anomalies), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.USER_ALREADY_EXISTS){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.User_already_exists), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.UNAUTHORIZED){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.registration_failed_without_permission), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.ILLEGAL_USER_NAME){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.illegal_user_name),Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), getResources().getString(R.string.Registration_failed) + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
}).start();
}
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:72,代码来源:RegisterActivity.java
示例16: register
import com.easemob.EMError; //导入依赖的package包/类
/**
* 注册
*
* @param view
*/
public void register(View view) {
String st1 = getResources().getString(R.string.User_name_cannot_be_empty);
String st2 = getResources().getString(R.string.Password_cannot_be_empty);
String st3 = getResources().getString(R.string.Confirm_password_cannot_be_empty);
String st4 = getResources().getString(R.string.Two_input_password);
String st5 = getResources().getString(R.string.Is_the_registered);
final String st6 = getResources().getString(R.string.Registered_successfully);
final String username = userNameEditText.getText().toString().trim();
final String pwd = passwordEditText.getText().toString().trim();
String confirm_pwd = confirmPwdEditText.getText().toString().trim();
if (TextUtils.isEmpty(username)) {
Toast.makeText(this, st1, Toast.LENGTH_SHORT).show();
userNameEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(pwd)) {
Toast.makeText(this, st2, Toast.LENGTH_SHORT).show();
passwordEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(confirm_pwd)) {
Toast.makeText(this, st3, Toast.LENGTH_SHORT).show();
confirmPwdEditText.requestFocus();
return;
} else if (!pwd.equals(confirm_pwd)) {
Toast.makeText(this, st4, Toast.LENGTH_SHORT).show();
return;
}
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(st5);
pd.show();
final String st7 = getResources().getString(R.string.network_anomalies);
final String st8 = getResources().getString(R.string.User_already_exists);
final String st9 = getResources().getString(R.string.registration_failed_without_permission);
final String st10 = getResources().getString(R.string.Registration_failed);
new Thread(new Runnable() {
public void run() {
try {
// 调用sdk注册方法
EMChatManager.getInstance().createAccountOnServer(username, pwd);
runOnUiThread(new Runnable() {
public void run() {
if (!RegisterActivity.this.isFinishing())
pd.dismiss();
// 保存用户名
MyApplication.getInstance().setUserName(username);
Toast.makeText(getApplicationContext(), st6, 0).show();
finish();
}
});
} catch (final EaseMobException e) {
runOnUiThread(new Runnable() {
public void run() {
if (!RegisterActivity.this.isFinishing())
pd.dismiss();
int errorCode=e.getErrorCode();
if(errorCode==EMError.NONETWORK_ERROR){
Toast.makeText(getApplicationContext(), st7, Toast.LENGTH_SHORT).show();
}else if(errorCode==EMError.USER_ALREADY_EXISTS){
Toast.makeText(getApplicationContext(), st8, Toast.LENGTH_SHORT).show();
}else if(errorCode==EMError.UNAUTHORIZED){
Toast.makeText(getApplicationContext(), st9, Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), st10 + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
}).start();
}
}
开发者ID:Owater,项目名称:school_shop,代码行数:79,代码来源:RegisterActivity.java
示例17: updateSendedView
import com.easemob.EMError; //导入依赖的package包/类
/**
* 更新ui上消息发送状态
*
* @param message
* @param holder
*/
private void updateSendedView(final EMMessage message, final ViewHolder holder) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// send success
if (message.getType() == Type.VIDEO) {
holder.tv.setVisibility(View.GONE);
}
EMLog.d(TAG, "message status : " + message.status);
if (message.status == EMMessage.Status.SUCCESS) {
// if (message.getType() == EMMessage.Type.FILE) {
// holder.pb.setVisibility(View.INVISIBLE);
// holder.staus_iv.setVisibility(View.INVISIBLE);
// } else {
// holder.pb.setVisibility(View.GONE);
// holder.staus_iv.setVisibility(View.GONE);
// }
} else if (message.status == EMMessage.Status.FAIL) {
// if (message.getType() == EMMessage.Type.FILE) {
// holder.pb.setVisibility(View.INVISIBLE);
// } else {
// holder.pb.setVisibility(View.GONE);
// }
// holder.staus_iv.setVisibility(View.VISIBLE);
if(message.getError() == EMError.MESSAGE_SEND_INVALID_CONTENT){
GreenToast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), 0)
.show();
}else if(message.getError() == EMError.MESSAGE_SEND_NOT_IN_THE_GROUP){
GreenToast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_not_in_the_group), 0)
.show();
}else{
GreenToast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0)
.show();
}
}
notifyDataSetChanged();
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:49,代码来源:MessageAdapter.java
示例18: register
import com.easemob.EMError; //导入依赖的package包/类
/**
* 注册
*
* @param view
*/
public void register(View view) {
final String username = userNameEditText.getText().toString().trim();
final String pwd = passwordEditText.getText().toString().trim();
String confirm_pwd = confirmPwdEditText.getText().toString().trim();
if (TextUtils.isEmpty(username)) {
Toast.makeText(this, getResources().getString(R.string.User_name_cannot_be_empty), Toast.LENGTH_SHORT).show();
userNameEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(pwd)) {
Toast.makeText(this, getResources().getString(R.string.Password_cannot_be_empty), Toast.LENGTH_SHORT).show();
passwordEditText.requestFocus();
return;
} else if (TextUtils.isEmpty(confirm_pwd)) {
Toast.makeText(this, getResources().getString(R.string.Confirm_password_cannot_be_empty), Toast.LENGTH_SHORT).show();
confirmPwdEditText.requestFocus();
return;
} else if (!pwd.equals(confirm_pwd)) {
Toast.makeText(this, getResources().getString(R.string.Two_input_password), Toast.LENGTH_SHORT).show();
return;
}
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(getResources().getString(R.string.Is_the_registered));
pd.show();
new Thread(new Runnable() {
public void run() {
try {
// 调用sdk注册方法
EMChatManager.getInstance().createAccountOnServer(username, pwd);
runOnUiThread(new Runnable() {
public void run() {
if (!EMChatRegisterActivity.this.isFinishing())
pd.dismiss();
// 保存用户名
MainApplication.getInstance().setUserName(username);
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.Registered_successfully), 0).show();
finish();
}
});
} catch (final EaseMobException e) {
runOnUiThread(new Runnable() {
public void run() {
if (!EMChatRegisterActivity.this.isFinishing())
pd.dismiss();
int errorCode=e.getErrorCode();
if(errorCode==EMError.NONETWORK_ERROR){
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.network_anomalies), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.USER_ALREADY_EXISTS){
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.User_already_exists), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.UNAUTHORIZED){
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.registration_failed_without_permission), Toast.LENGTH_SHORT).show();
}else if(errorCode == EMError.ILLEGAL_USER_NAME){
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.illegal_user_name),Toast.LENGTH_SHORT).show();
}else{
GreenToast.makeText(getApplicationContext(), getResources().getString(R.string.Registration_failed) + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
}).start();
}
}
开发者ID:chenjunqian,项目名称:here,代码行数:72,代码来源:EMChatRegisterActivity.java
示例19: setGlobalListeners
import com.easemob.EMError; //导入依赖的package包/类
/**
* 设置全局事件监听
*/
protected void setGlobalListeners() {
syncGroupsListeners = new ArrayList<DataSyncListener>();
syncContactsListeners = new ArrayList<DataSyncListener>();
syncBlackListListeners = new ArrayList<DataSyncListener>();
isGroupsSyncedWithServer = demoModel.isGroupsSynced();
isContactsSyncedWithServer = demoModel.isContactSynced();
isBlackListSyncedWithServer = demoModel.isBacklistSynced();
// create the global connection listener
connectionListener = new EMConnectionListener() {
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED) {
onCurrentAccountRemoved();
} else if (error == EMError.CONNECTION_CONFLICT) {
onConnectionConflict();
}
}
@Override
public void onConnected() {
// in case group and contact were already synced, we supposed to notify sdk we are ready to receive the events
if (isGroupsSyncedWithServer && isContactsSyncedWithServer) {
new Thread() {
@Override
public void run() {
DemoHelper.getInstance().notifyForRecevingEvents();
}
}.start();
} else {
if (!isGroupsSyncedWithServer) {
asyncFetchGroupsFromServer(null);
}
if (!isContactsSyncedWithServer) {
asyncFetchContactsFromServer(null);
}
if (!isBlackListSyncedWithServer) {
asyncFetchBlackListFromServer(null);
}
}
}
};
IntentFilter callFilter = new IntentFilter(EMChatManager.getInstance().getIncomingCallBroadcastAction());
if (callReceiver == null) {
callReceiver = new CallReceiver();
}
//注册通话广播接收者
appContext.registerReceiver(callReceiver, callFilter);
//注册连接监听
EMChatManager.getInstance().addConnectionListener(connectionListener);
//注册群组和联系人监听
registerGroupAndContactListener();
//注册消息事件监听
registerEventListener();
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:67,代码来源:DemoHelper.java
示例20: searchGroup
import com.easemob.EMError; //导入依赖的package包/类
/**
* 搜索
*
* @param v
*/
public void searchGroup(View v) {
if (TextUtils.isEmpty(idET.getText())) {
return;
}
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(getResources().getString(R.string.searching));
pd.setCancelable(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
searchedGroup = EMGroupManager.getInstance().getGroupFromServer(idET.getText().toString());
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
containerLayout.setVisibility(View.VISIBLE);
nameText.setText(searchedGroup.getGroupName());
}
});
} catch (final EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
searchedGroup = null;
containerLayout.setVisibility(View.GONE);
if (e.getErrorCode() == EMError.GROUP_NOT_EXIST) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_not_existed), 0).show();
} else {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_search_failed) + " : " + getString(R.string.connect_failuer_toast), 0).show();
}
}
});
}
}
}).start();
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:48,代码来源:PublicGroupsSeachActivity.java
注:本文中的com.easemob.EMError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论