本文整理汇总了Java中com.easemob.EMCallBack类的典型用法代码示例。如果您正苦于以下问题:Java EMCallBack类的具体用法?Java EMCallBack怎么用?Java EMCallBack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMCallBack类属于com.easemob包,在下文中一共展示了EMCallBack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendMsgInBackground
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 发送消息
*
* @param message
* @param holder
*/
public void sendMsgInBackground(final EMMessage message, final ViewHolder holder) {
holder.staus_iv.setVisibility(View.GONE);
holder.pb.setVisibility(View.VISIBLE);
EMChatManager.getInstance().sendMessage(message, new EMCallBack() {
@Override
public void onSuccess() {
updateSendedView(message, holder);
}
@Override
public void onError(int code, String error) {
updateSendedView(message, holder);
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:macyuan,项目名称:TAG,代码行数:29,代码来源:MessageAdapter.java
示例2: easeMobLogin
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 用户登录
*
* @param handler
*/
public void easeMobLogin(final Handler handler) {
UserBean user = AppContext.getInstance().getUser();
String name = user.getId();
String pwd = "pwd" + user.getId();
EMChatManager.getInstance().login(name, pwd, new EMCallBack() {
@Override
public void onSuccess() {
handler.sendEmptyMessage(0);
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
handler.sendEmptyMessage(1);
}
});
}
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:27,代码来源:EaseMobService.java
示例3: logoutEMChat
import com.easemob.EMCallBack; //导入依赖的package包/类
public static void logoutEMChat(){
//此方法为异步方法
EMChatManager.getInstance().logout(new EMCallBack() {
@Override
public void onSuccess() {
LogUtil.d("EMChatUtil", "登出成功!");
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
LogUtil.d("EMChatUtil", "登出失败!"+" code "+code+" message : "+message);
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:22,代码来源:EMChatUtil.java
示例4: asyncFetchGroupsFromServer
import com.easemob.EMCallBack; //导入依赖的package包/类
static void asyncFetchGroupsFromServer(){
HXSDKHelper.getInstance().asyncFetchGroupsFromServer(new EMCallBack() {
@Override
public void onSuccess() {
HXSDKHelper.getInstance().noitifyGroupSyncListeners(true);
if (HXSDKHelper.getInstance().isContactsSyncedWithServer()) {
HXSDKHelper.getInstance().notifyForRecevingEvents();
}
}
@Override
public void onError(int code, String message) {
HXSDKHelper.getInstance().noitifyGroupSyncListeners(false);
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:25,代码来源:EMChatMainActivity.java
示例5: sendMsgInBackground
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 发送消息
*
* @param message
* @param holder
*/
public void sendMsgInBackground(final EMMessage message, final ViewHolder holder) {
holder.staus_iv.setVisibility(View.GONE);
holder.pb.setVisibility(View.VISIBLE);
final long start = System.currentTimeMillis();
// 调用sdk发送异步发送方法
EMChatManager.getInstance().sendMessage(message, new EMCallBack() {
@Override
public void onSuccess() {
updateSendedView(message, holder);
}
@Override
public void onError(int code, String error) {
updateSendedView(message, holder);
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:34,代码来源:MessageAdapter.java
示例6: EASEMOBLogin
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 登陆环信
*/
private void EASEMOBLogin() {
EMChatManager.getInstance().login(phone, password, new EMCallBack() {//回调
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
dialogDismiss();
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
toMainActivity();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
runOnUiThread(new Runnable() {
public void run() {
dialogDismiss();
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
toMainActivity();
}
});
}
});
}
开发者ID:tengbinlive,项目名称:info_demo,代码行数:36,代码来源:LoginActivity.java
示例7: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 退出登录
*
* @param unbindDeviceToken
* 是否解绑设备token(使用GCM才有)
* @param callback
* callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
EMChatManager.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
reset();
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onProgress(int progress, String status) {
if (callback != null) {
callback.onProgress(progress, status);
}
}
@Override
public void onError(int code, String error) {
if (callback != null) {
callback.onError(code, error);
}
}
});
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:36,代码来源:DemoHelper.java
示例8: registerInternalDebugReceiver
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 内部测试代码,开发者请忽略
*/
private void registerInternalDebugReceiver() {
internalDebugReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DemoHelper.getInstance().logout(false,new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
// 重新显示登陆页面
finish();
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {}
@Override
public void onError(int code, String message) {}
});
}
};
IntentFilter filter = new IntentFilter(getPackageName() + ".em_internal_debug");
registerReceiver(internalDebugReceiver, filter);
}
开发者ID:easemob,项目名称:sdkdemoapp3.0_android,代码行数:34,代码来源:MainActivity.java
示例9: onActivityCreated
import com.easemob.EMCallBack; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Button logoutButton = (Button) getView().findViewById(R.id.btn_logout);
logoutButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EMChatManager.getInstance().logout(new EMCallBack() {
@Override
public void onSuccess() {
getActivity().finish();
startActivity(new Intent(getActivity(), LoginActivity.class));
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String error) {
}
});
}
});
}
开发者ID:easemob,项目名称:easeui,代码行数:31,代码来源:SettingsFragment.java
示例10: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* logout HuanXin SDK
*/
public void logout(final EMCallBack callback){
setPassword(null);
EMChatManager.getInstance().logout(new EMCallBack(){
@Override
public void onSuccess() {
// TODO Auto-generated method stub
if(callback != null){
callback.onSuccess();
}
}
@Override
public void onError(int code, String message) {
// TODO Auto-generated method stub
}
@Override
public void onProgress(int progress, String status) {
// TODO Auto-generated method stub
if(callback != null){
callback.onProgress(progress, status);
}
}
});
}
开发者ID:Owater,项目名称:school_shop,代码行数:32,代码来源:HXSDKHelper.java
示例11: sendMsgInBackground
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 发送消息
*
* @param message
* @param holder
* @param position
*/
public void sendMsgInBackground(final EMMessage message, final ViewHolder holder) {
holder.staus_iv.setVisibility(View.GONE);
holder.pb.setVisibility(View.VISIBLE);
final long start = System.currentTimeMillis();
// 调用sdk发送异步发送方法
EMChatManager.getInstance().sendMessage(message, new EMCallBack() {
@Override
public void onSuccess() {
updateSendedView(message, holder);
}
@Override
public void onError(int code, String error) {
updateSendedView(message, holder);
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:Owater,项目名称:school_shop,代码行数:35,代码来源:MessageAdapter.java
示例12: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
@Override
public void logout(final EMCallBack callback){
// endCall();
super.logout(new EMCallBack(){
@Override
public void onSuccess() {
setContactList(null);
getModel().closeDB();
if(callback != null){
callback.onSuccess();
}
}
@Override
public void onError(int code, String message) {
// TODO Auto-generated method stub
}
@Override
public void onProgress(int progress, String status) {
// TODO Auto-generated method stub
if(callback != null){
callback.onProgress(progress, status);
}
}
});
}
开发者ID:Owater,项目名称:school_shop,代码行数:31,代码来源:DemoHXSDKHelper.java
示例13: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* logout HuanXin SDK
*/
public void logout(final boolean unbindDeviceToken,final EMCallBack callback){
setPassword(null);
reset();
EMChatManager.getInstance().logout(unbindDeviceToken,new EMCallBack(){
@Override
public void onSuccess() {
if(callback != null){
callback.onSuccess();
}
}
@Override
public void onError(int code, String message) {
if(callback != null){
callback.onError(code, message);
}
}
@Override
public void onProgress(int progress, String status) {
if(callback != null){
callback.onProgress(progress, status);
}
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:32,代码来源:HXSDKHelper.java
示例14: asyncFetchGroupsFromServer
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 同步操作,从服务器获取群组列表
* 该方法会记录更新状态,可以通过isSyncingGroupsFromServer获取是否正在更新
* 和HXPreferenceUtils.getInstance().getSettingSyncGroupsFinished()获取是否更新已经完成
* @throws EaseMobException
*/
public synchronized void asyncFetchGroupsFromServer(final EMCallBack callback){
if(isSyncingGroupsWithServer){
return;
}
isSyncingGroupsWithServer = true;
new Thread(){
@Override
public void run(){
try {
EMGroupManager.getInstance().getGroupsFromServer();
// in case that logout already before server returns, we should return immediately
if(!EMChat.getInstance().isLoggedIn()){
return;
}
hxModel.setGroupsSynced(true);
isGroupsSyncedWithServer = true;
isSyncingGroupsWithServer = false;
if(callback != null){
callback.onSuccess();
}
} catch (EaseMobException e) {
hxModel.setGroupsSynced(false);
isGroupsSyncedWithServer = false;
isSyncingGroupsWithServer = false;
if(callback != null){
callback.onError(e.getErrorCode(), e.toString());
}
}
}
}.start();
}
开发者ID:chenjunqian,项目名称:here,代码行数:44,代码来源:HXSDKHelper.java
示例15: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
@Override
public void logout(final boolean unbindDeviceToken,final EMCallBack callback){
endCall();
super.logout(unbindDeviceToken,new EMCallBack(){
@Override
public void onSuccess() {
// TODO Auto-generated method stub
setContactList(null);
setRobotList(null);
getUserProfileManager().reset();
getModel().closeDB();
if(callback != null){
callback.onSuccess();
}
}
@Override
public void onError(int code, String message) {
// TODO Auto-generated method stub
if(callback != null){
callback.onError(code, message);
}
}
@Override
public void onProgress(int progress, String status) {
// TODO Auto-generated method stub
if(callback != null){
callback.onProgress(progress, status);
}
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:36,代码来源:DemoHXSDKHelper.java
示例16: registerInternalDebugReceiver
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 内部测试代码,开发者请忽略
*/
private void registerInternalDebugReceiver() {
internalDebugReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DemoHXSDKHelper.getInstance().logout(true,new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
// 重新显示登陆页面
finish();
startActivity(new Intent(EMChatMainActivity.this, EMChatLoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {}
@Override
public void onError(int code, String message) {}
});
}
};
IntentFilter filter = new IntentFilter(getPackageName() + ".em_internal_debug");
registerReceiver(internalDebugReceiver, filter);
}
开发者ID:chenjunqian,项目名称:here,代码行数:34,代码来源:EMChatMainActivity.java
示例17: loginEMChat
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 登录环信,因为改为使用用户id来登录,为了保证在登录本服务器后,获取到用户信息再登录环信服务器
*
* @param id
* @param password
*/
private void loginEMChat(String id, String password) {
//登录环信SDK
EMChatManager.getInstance().login(id, password, new EMCallBack() {//回调
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
EMGroupManager.getInstance().loadAllGroups();
EMChatManager.getInstance().loadAllConversations();
EMChatUtil.isConnectedEMChatServer = true;
LogUtil.d("SplashActivity", "登陆聊天服务器成功!");
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
EMChatUtil.isConnectedEMChatServer = false;
LogUtil.d("SplashActivity", "登陆聊天服务器失败!" + " code " + code + " message : " + message);
}
});
}
开发者ID:chenjunqian,项目名称:here,代码行数:34,代码来源:MainActivity.java
示例18: logout
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 退出登录
*
* @param unbindDeviceToken 是否解绑设备token(使用GCM才有)
* @param callback callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
EMChatManager.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
reset();
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onProgress(int progress, String status) {
if (callback != null) {
callback.onProgress(progress, status);
}
}
@Override
public void onError(int code, String error) {
if (callback != null) {
callback.onError(code, error);
}
}
});
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:35,代码来源:DemoHelper.java
示例19: registerInternalDebugReceiver
import com.easemob.EMCallBack; //导入依赖的package包/类
/**
* 内部测试代码,开发者请忽略
*/
private void registerInternalDebugReceiver() {
internalDebugReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DemoHelper.getInstance().logout(true, new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
// 重新显示登陆页面
finish();
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
}
});
}
};
IntentFilter filter = new IntentFilter(getPackageName() + ".em_internal_debug");
registerReceiver(internalDebugReceiver, filter);
}
开发者ID:nggirl,项目名称:EaseChatDemo,代码行数:36,代码来源:MainActivity.java
示例20: sendPictureMessage
import com.easemob.EMCallBack; //导入依赖的package包/类
private void sendPictureMessage(final EMMessage message, final ViewHolder holder) {
try {
String to = message.getTo();
// before send, update ui
holder.staus_iv.setVisibility(View.GONE);
holder.pb.setVisibility(View.VISIBLE);
holder.tv.setVisibility(View.VISIBLE);
holder.tv.setText("0%");
// if (chatType == ChatActivity.CHATTYPE_SINGLE) {
EMChatManager.getInstance().sendMessage(message, new EMCallBack() {
@Override
public void onSuccess() {
Log.d("send image message successfully");
activity.runOnUiThread(new Runnable() {
public void run() {
// send success
holder.pb.setVisibility(View.GONE);
holder.tv.setVisibility(View.GONE);
}
});
}
@Override
public void onError(int code, String error) {
activity.runOnUiThread(new Runnable() {
public void run() {
holder.pb.setVisibility(View.GONE);
holder.tv.setVisibility(View.GONE);
// message.setSendingStatus(Message.SENDING_STATUS_FAIL);
holder.staus_iv.setVisibility(View.VISIBLE);
Toast.makeText(activity,
activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show();
}
});
}
@Override
public void onProgress(final int progress, String status) {
activity.runOnUiThread(new Runnable() {
public void run() {
holder.tv.setText(progress + "%");
}
});
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:macyuan,项目名称:TAG,代码行数:53,代码来源:MessageAdapter.java
注:本文中的com.easemob.EMCallBack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论