本文整理汇总了Java中com.hyphenate.EMError类的典型用法代码示例。如果您正苦于以下问题:Java EMError类的具体用法?Java EMError怎么用?Java EMError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMError类属于com.hyphenate包,在下文中一共展示了EMError类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:turoDog,项目名称:KTalk,代码行数:21,代码来源:EaseVoiceRecorder.java
示例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();
}
});
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:20,代码来源:EaseChatRow.java
示例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);
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:9,代码来源:EaseConversationListFragment.java
示例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();
}
});
}
}
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:EaseContactListFragment.java
示例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();
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:15,代码来源:EaseChatRow.java
示例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);
}
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:10,代码来源:EaseConversationListFragment.java
示例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);
}
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:12,代码来源:MessageFragment.java
示例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));
}
});
}
}
开发者ID:Vicent9920,项目名称:FanChat,代码行数:13,代码来源:MainActivity.java
示例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();
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:15,代码来源:EaseChatRow.java
示例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);
//当前网络不可用,请检查网络设置
}
}
}
});
}
开发者ID:jiangzehui,项目名称:HX,代码行数:32,代码来源:MainActivity.java
示例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);
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:9,代码来源:EaseConversationListFragment.java
示例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();
}
});
}
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:14,代码来源:EaseContactListFragment.java
示例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();
}
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:39,代码来源:HuanXinHelper.java
示例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);
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:45,代码来源:EaseConversationListFragment.java
示例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();
}
});
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:47,代码来源:EaseContactListFragment.java
示例16: searchGroup
import com.hyphenate.EMError; //导入依赖的package包/类
/**
* search group with group id
* @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 = EMClient.getInstance().groupManager().getGroupFromServer(idET.getText().toString());
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
containerLayout.setVisibility(View.VISIBLE);
nameText.setText(searchedGroup.getGroupName());
}
});
} catch (final HyphenateException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
searchedGroup = null;
containerLayout.setVisibility(View.GONE);
if(e.getErrorCode() == EMError.GROUP_INVALID_ID){
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_not_existed), Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), getResources().getString(R.string.group_search_failed) + " : " + getString(R.string.connect_failuer_toast), Toast.LENGTH_SHORT).show();
}
}
});
}
}
}).start();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:47,代码来源:PublicGroupsSeachActivity.java
示例17: setGlobalListeners
import com.hyphenate.EMError; //导入依赖的package包/类
/**
* set global listener
*/
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) {
EMLog.d("global listener", "onDisconnect" + error);
if (error == EMError.USER_REMOVED) {
onUserException(Constant.ACCOUNT_REMOVED);
return;
} else if (error == EMError.USER_LOGIN_ANOTHER_DEVICE) {
onUserException(Constant.ACCOUNT_CONFLICT);
} else if (error == EMError.SERVER_SERVICE_RESTRICTED) {
onUserException(Constant.ACCOUNT_FORBIDDEN);
}
}
@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) {
// EMLog.d(TAG, "group and contact already synced with servre");
// } else {
// if (!isGroupsSyncedWithServer) {
asyncFetchGroupsFromServer(null);
// }
// if (!isContactsSyncedWithServer) {
asyncFetchContactsFromServer(null);
// }
// if (!isBlackListSyncedWithServer) {
asyncFetchBlackListFromServer(null);
// }
// }
}
};
IntentFilter callFilter = new IntentFilter(EMClient.getInstance().callManager().getIncomingCallBroadcastAction());
if (callReceiver == null) {
callReceiver = new CallReceiver();
}
//register incoming call receiver
appContext.registerReceiver(callReceiver, callFilter);
//register connection listener
EMClient.getInstance().addConnectionListener(connectionListener);
//register group and contact event listener
registerGroupAndContactListener();
//register message event listener
registerMessageListener();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:66,代码来源:DemoHelper.java
示例18: setGlobalListeners
import com.hyphenate.EMError; //导入依赖的package包/类
/**
* set global listener
*/
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.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(isGroupsSyncedWithServer && isContactsSyncedWithServer){
EMLog.d(TAG, "group and contact already synced with servre");
}else{
if(!isGroupsSyncedWithServer){
asyncFetchGroupsFromServer(null);
}
if(!isContactsSyncedWithServer){
asyncFetchContactsFromServer(null);
}
if(!isBlackListSyncedWithServer){
asyncFetchBlackListFromServer(null);
}
}
}
};
IntentFilter callFilter = new IntentFilter(EMClient.getInstance().callManager().getIncomingCallBroadcastAction());
if(callReceiver == null){
callReceiver = new CallReceiver();
}
//register incoming call receiver
appContext.registerReceiver(callReceiver, callFilter);
//register connection listener
EMClient.getInstance().addConnectionListener(connectionListener);
//register group and contact event listener
registerGroupAndContactListener();
//register message event listener
registerMessageListener();
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:60,代码来源:DemoHelper.java
示例19: searchGroup
import com.hyphenate.EMError; //导入依赖的package包/类
/**
* search group with group id
* @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 = EMClient.getInstance().groupManager().getGroupFromServer(idET.getText().toString());
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
containerLayout.setVisibility(View.VISIBLE);
nameText.setText(searchedGroup.getGroupName());
}
});
} catch (final HyphenateException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
searchedGroup = null;
containerLayout.setVisibility(View.GONE);
if(e.getErrorCode() == EMError.GROUP_INVALID_ID){
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:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:47,代码来源:PublicGroupsSeachActivity.java
注:本文中的com.hyphenate.EMError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论