本文整理汇总了Java中com.hyphenate.EMError类的典型用法代码示例。如果您正苦于以下问题:Java EMError类的具体用法?Java EMError怎么用?Java EMError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMError类属于com.hyphenate包,在下文中一共展示了EMError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopRecoding
import com.hyphenate.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.FILE_INVALID;
}
if (file.length() == 0) {
file.delete();
return EMError.FILE_INVALID;
}
int seconds = (int) (new Date().getTime() - startTime) / 1000;
EMLog.d("voice", "voice recording finished. seconds:" + seconds + " file length:" + file.length());
return seconds;
}
return 0;
}
示例2: updateView
import com.hyphenate.EMError; //导入依赖的package包/类
protected void updateView() {
activity.runOnUiThread(new Runnable() {
public void run() {
if (message.status() == EMMessage.Status.FAIL) {
if (message.getError() == EMError.MESSAGE_INCLUDE_ILLEGAL_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.GROUP_NOT_JOINED) {
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();
}
});
}
示例3: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE || error == EMError.SERVER_SERVICE_RESTRICTED) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
示例4: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE || error == EMError.SERVER_SERVICE_RESTRICTED) {
isConflict = true;
} else {
getActivity().runOnUiThread(new Runnable() {
public void run() {
onConnectionDisconnected();
}
});
}
}
示例5: updateView
import com.hyphenate.EMError; //导入依赖的package包/类
protected void updateView(final int errorCode, final String desc) {
activity.runOnUiThread(new Runnable() {
public void run() {
if (errorCode == EMError.MESSAGE_INCLUDE_ILLEGAL_CONTENT) {
Toast.makeText(activity,activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), Toast.LENGTH_SHORT).show();
} else if (errorCode == EMError.GROUP_NOT_JOINED) {
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();
}
onUpdateView();
}
});
}
示例6: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE || error == EMError.SERVER_SERVICE_RESTRICTED
|| error == EMError.USER_KICKED_BY_CHANGE_PASSWORD || error == EMError.USER_KICKED_BY_OTHER_DEVICE) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
示例7: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
//USER_REMOVED:账号已经被移除 USER_LOGIN_ANOTHER_DEVICE:账号在别的地方登录
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE || error == EMError.SERVER_SERVICE_RESTRICTED
|| error == EMError.USER_KICKED_BY_CHANGE_PASSWORD || error == EMError.USER_KICKED_BY_OTHER_DEVICE) {
isConflict = true;
} else {
Log.d("----", "onDisconnected: 环信出现问题,断线了");
handler.sendEmptyMessage(0);
}
}
示例8: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int i) {
if (i == EMError.USER_LOGIN_ANOTHER_DEVICE) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
startActivity(LoginActivity.class);
toast(getString(R.string.user_login_another_device));
}
});
}
}
示例9: updateView
import com.hyphenate.EMError; //导入依赖的package包/类
protected void updateView(final int errorCode, final String desc) {
activity.runOnUiThread(new Runnable() {
public void run() {
if (errorCode == EMError.MESSAGE_INCLUDE_ILLEGAL_CONTENT) {
Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.error_send_invalid_content), Toast.LENGTH_SHORT).show();
} else if (errorCode == EMError.GROUP_NOT_JOINED) {
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();
}
onUpdateView();
}
});
}
示例10: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(final int error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (error == EMError.USER_REMOVED) {
T.open(MainActivity.this, LoginActivity.class);
T.show("帐号已经被移除");
finish();
// 显示帐号已经被移除
} else if (error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
T.open(MainActivity.this, LoginActivity.class);
T.show("帐号在其他设备登录");
finish();
// 显示帐号在其他设备登录
} else {
if (NetUtils.hasNetwork(MainActivity.this)) {
tvTishi.setText("连接不到聊天服务器");
tvTishi.setVisibility(View.VISIBLE);
//连接不到聊天服务器
} else {
tvTishi.setText("当前网络不可用,请检查网络设置");
tvTishi.setVisibility(View.VISIBLE);
//当前网络不可用,请检查网络设置
}
}
}
});
}
示例11: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
isConflict = true;
} else {
handler.sendEmptyMessage(0);
}
}
示例12: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
isConflict = true;
} else {
getActivity().runOnUiThread(new Runnable() {
public void run() {
onConnectionDisconnected();
}
});
}
}
示例13: setGlobalListeners
import com.hyphenate.EMError; //导入依赖的package包/类
/**
* 设置全局事件监听
*/
protected void setGlobalListeners(){
// create the global connection listener
connectionListener = new EMConnectionListener() {
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED) {
onCurrentAccountRemoved();
}else if (error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
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(true){
new Thread(){
@Override
public void run(){
HuanXinHelper.getInstance().notifyForRecevingEvents();
}
}.start();
}else{
}
}
};
//注册连接监听
EMClient.getInstance().addConnectionListener(connectionListener);
//注册消息事件监听
registerEventListener();
}
示例14: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.SERVER_SERVICE_RESTRICTED) {
// GApplication.getInstance().showLogout(getActivity());
// isConflict = true;
return;
} else if (error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
// GApplication.getInstance().showLogout(getActivity());
try {
// BroadcastReceiverUtils.sendBroadcastReceiver(mContext,BroadcastReceiverUtils.LOGIN_OUT);
// GApplication.getInstance().showLogout(mContext);
// if ( getActivity() instanceof MainActivity){
// ((MainActivity)getActivity()).LoingOut();
// }else if (getActivity() instanceof SearchActivity){
// ((SearchActivity)getActivity()).LoingOut();
// }else {
// ACache.get(getActivity()).clear();
// ACache.get(getActivity()).put(ACacheKey.FIRST_USE, "111");
// ToastUtil.showToast("登录信息已失效,请重新登录",getActivity());
// Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
//
// ActivityManagerUtil.getInstance().finishAllActivity();
// Intent intent = new Intent(getActivity(), LoginActivity.class);
// getActivity().startActivity(intent);
// }
// },1000);
// }
LoginOut();
} catch (Exception e1) {
}
} else {
handler.sendEmptyMessage(0);
}
}
示例15: onDisconnected
import com.hyphenate.EMError; //导入依赖的package包/类
@Override
public void onDisconnected(int error) {
if (error == EMError.USER_REMOVED || error == EMError.SERVER_SERVICE_RESTRICTED) {
isConflict = true;
} else if (error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
// GApplication.getInstance().showLogout(getActivity());
try {
// BroadcastReceiverUtils.sendBroadcastReceiver(mContext,BroadcastReceiverUtils.LOGIN_OUT);
// GApplication.getInstance().showLogout(mContext);
// ACache.get(getActivity()).clear();
// ACache.get(getActivity()).put(ACacheKey.FIRST_USE, "111");
// ToastUtil.showToast("登录信息已失效,请重新登录",getActivity());
//
//
// Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
//
// ActivityManagerUtil.getInstance().finishAllActivity();
// Intent intent = new Intent(getActivity(), LoginActivity.class);
// getActivity().startActivity(intent);
// }
// },1000);
if (getActivity() instanceof EaseBaseActivity){
((EaseBaseActivity)getActivity()).LoingOut();
}else if (getActivity() instanceof MainActivity){
((MainActivity)getActivity()).LoingOut();
}
} catch (Exception e1) {
}
} else {
getActivity().runOnUiThread(new Runnable() {
public void run() {
onConnectionDisconnected();
}
});
}
}