本文整理汇总了Java中com.hyphenate.EMCallBack类的典型用法代码示例。如果您正苦于以下问题:Java EMCallBack类的具体用法?Java EMCallBack怎么用?Java EMCallBack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMCallBack类属于com.hyphenate包,在下文中一共展示了EMCallBack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: login
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 登陆操作
*/
private void login() {
String str_user = etUser.getText().toString();
String str_pswd = etPswd.getText().toString();
EMClient.getInstance().login(str_user, str_pswd, new EMCallBack() {//回调
@Override
public void onSuccess() {
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
Log.d("main", "登录聊天服务器成功!");
handler.sendEmptyMessage(0);
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
handler.sendEmptyMessage(1);
Log.d("main", "登录聊天服务器失败!");
}
});
}
示例2: onActivityCreated
import com.hyphenate.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) {
EMClient.getInstance().logout(false, 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) {
}
});
}
});
}
示例3: downloadVideo
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* download video file
*/
private void downloadVideo(EMMessage message) {
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
loadingLayout.setVisibility(View.GONE);
progressBar.setProgress(0);
showLocalVideo(localFilePath);
}
});
}
@Override
public void onProgress(final int progress,String status) {
Log.d("ease", "video progress:" + progress);
runOnUiThread(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progress);
}
});
}
@Override
public void onError(int error, String msg) {
Log.e("###", "offline file transfer error:" + msg);
File file = new File(localFilePath);
if (file.exists()) {
file.delete();
}
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}
示例4: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresemter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
//通知p层
mPresemter.registerUserSuccess();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresemter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresemter.registerUserFailue();
}
});
}
});
}
示例5: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登录
*/
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresenter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
mPresenter.onLoginSuccess();
getCountryIsOpenData();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresenter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresenter.onLoginFailue(error);
}
});
}
});
}
示例6: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登录
*/
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresenter.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
mPresenter.onSilentLoginSuccess();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresenter.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresenter.onSlientLoginFailure();
}
});
}
});
}
示例7: updateAnnouncement
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* update with the passed announcement
*
* @param announcement
*/
private void updateAnnouncement(final String announcement) {
createProgressDialog();
progressDialog.setMessage("Updating ...");
progressDialog.show();
EMClient.getInstance().groupManager().asyncUpdateGroupAnnouncement(groupId, announcement,
new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
announcementText.setText(announcement);
}
});
}
@Override
public void onError(int code, final String error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
Toast.makeText(GroupDetailsActivity.this, "update fail," + error, Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
});
}
示例8: updateAnnouncement
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* update with the passed announcement
* @param announcement
*/
private void updateAnnouncement(final String announcement) {
createProgressDialog();
progressDialog.setMessage("Updating ...");
progressDialog.show();
EMClient.getInstance().groupManager().asyncUpdateGroupAnnouncement(roomId, announcement,
new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
announcementText.setText(announcement);
}
});
}
@Override
public void onError(int code, final String error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
Toast.makeText(ChatRoomDetailsActivity.this, "update fail," + error, Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
});
}
示例9: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* logout
*
* @param unbindDeviceToken whether you need unbind your device token
* @param callback callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: 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) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
示例10: logOut
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登出
*/
public static void logOut(final IHuanxing huanxing){
SLog.d("<><><><><><>", "退出登录开始");
EMClient.getInstance().logout(true, new EMCallBack() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
SLog.d("<><><><><><>", "退出登录成功");
if(huanxing!=null){
huanxing.success();
}
}
@Override
public void onProgress(int progress, String status) {
// TODO Auto-generated method stub
}
@Override
public void onError(int code, String message) {
// TODO Auto-generated method stub
SLog.d("<><><><><><>", "退出登录失败");
if(huanxing!=null){
huanxing.falue();
}
}
});
}
示例11: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* logout
*
* @param unbindDeviceToken
* whether you need unbind your device token
* @param callback
* callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: 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) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
示例12: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
void logout() {
final ProgressDialog pd = new ProgressDialog(getActivity());
String st = getResources().getString(R.string.Are_logged_out);
pd.setMessage(st);
pd.setCanceledOnTouchOutside(false);
pd.show();
DemoHelper.getInstance().logout(false,new EMCallBack() {
@Override
public void onSuccess() {
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
// show login screen
((MainActivity) getActivity()).finish();
startActivity(new Intent(getActivity(), LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
pd.dismiss();
Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();
}
});
}
});
}
示例13: registerInternalDebugReceiver
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* debug purpose only, you can ignore this
*/
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);
}
示例14: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 退出登录
*
* @param unbindDeviceToken
* 是否解绑设备token(使用GCM才有)
* @param callback
* callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: 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) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
示例15: rightAfterLogOn
import com.hyphenate.EMCallBack; //导入依赖的package包/类
private static void rightAfterLogOn(){
SeriesLogOnInfo.putInfo(MyApp.getInstance().getApplicationContext(), MyApp.userInfo.username, MyApp.userInfo.userpassword);
EMClient.getInstance().login(MyApp.userInfo.userId,SHA1(MyApp.userInfo.userpassword) ,new EMCallBack() {//回调
@Override
public void onSuccess() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
Log.d("main", "登陆聊天服务器成功!");
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
Log.d("main", "登陆聊天服务器失败!");
}
});
MobclickAgent.onProfileSignIn(MyApp.userInfo.userId);
NoteController.iniCloudSyncTask();
ServiceFactory.getAccountService().getAllNote(AuthBody.getAuthBodyMap())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<AuthorBean>() {
@Override
public void call(AuthorBean authorBean) {
MyApp.getInstance().authorBean.author = authorBean.author;
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
}