• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EMOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hyphenate.chat.EMOptions的典型用法代码示例。如果您正苦于以下问题:Java EMOptions类的具体用法?Java EMOptions怎么用?Java EMOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EMOptions类属于com.hyphenate.chat包,在下文中一共展示了EMOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    //初始化EaseUI
    EMOptions options = new EMOptions();
    options.setAcceptInvitationAlways(false);//设置需要同意后才接受邀请
    options.setAutoAcceptGroupInvitation(false);//设置需要同意后才能进行群邀请

    EaseUI.getInstance().init(this,options);

    //初始化数据模型层类
    Model.getInstance().init(this);

    //初始化全局上下文对象
    mContext = this;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:17,代码来源:InitApplication.java


示例2: initHuanXin

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private void initHuanXin() {
        EMOptions options = new EMOptions();
// 默认添加好友时,是不需要验证的,改成需要验证
        options.setAcceptInvitationAlways(true);
        int pid = android.os.Process.myPid();
        String processAppName = getAppName(pid);
// 如果APP启用了远程的service,此application:onCreate会被调用2次
// 为了防止环信SDK被初始化2次,加此判断会保证SDK被初始化1次
// 默认的APP会在以包名为默认的process name下运行,如果查到的process name不是APP的process name就立即返回

        if (processAppName == null ||!processAppName.equalsIgnoreCase(getPackageName())) {
            Log.e(TAG, "enter the service process!");
            // 则此application::onCreate 是被service 调用的,直接返回
            return;
        }

//初始化
        EMClient.getInstance().init(getApplicationContext(), options);
//在做打包混淆时,关闭debug模式,避免消耗不必要的资源
        if (BuildConfig.DEBUG) {
            EMClient.getInstance().setDebugMode(true);
        }
    }
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:24,代码来源:QQDemoApplication.java


示例3: onCreate

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
        T.context = getApplicationContext();

        EMOptions options = new EMOptions();
        options.setAutoLogin(true);

        // 默认添加好友时,是不需要验证的,改成需要验证
        //options.setAcceptInvitationAlways(false);
        //初始化
        EMClient.getInstance().init(getApplicationContext(), options);
//在做打包混淆时,关闭debug模式,避免消耗不必要的资源
        EMClient.getInstance().setDebugMode(true);

    }
 
开发者ID:jiangzehui,项目名称:HX,代码行数:17,代码来源:MyApplication.java


示例4: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
protected EMOptions initChatOptions(){
        Log.d(TAG, "init HuanXin Options");
        
        // 获取到EMChatOptions对象
        EMOptions options = new EMOptions();
        // 默认添加好友时,是不需要验证的,改成需要验证
        options.setAcceptInvitationAlways(false);
        // 设置是否需要已读回执
        options.setRequireAck(true);
        // 设置是否需要已送达回执
        options.setRequireDeliveryAck(false);
        // 设置从db初始化加载时, 每个conversation需要加载msg的个数
        options.setNumberOfMessagesLoaded(1);
        
        return options;
//        notifier.setNotificationInfoProvider(getNotificationListener());
    }
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:18,代码来源:EaseUI.java


示例5: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 * init helper
 * 
 * @param context
 *            application context
 */
public void init(Context context) {
    demoModel = new DemoModel(context);
    EMOptions options = initChatOptions();
    //use default options if options is null
	if (EaseUI.getInstance().init(context, options)) {
	    appContext = context;
	    
	    //debug mode, you'd better set it to false, if you want release your App officially.
	    EMClient.getInstance().setDebugMode(true);
	    //get easeui instance
	    easeUI = EaseUI.getInstance();
	    //to set user's profile and avatar
	    setEaseUIProviders();
		//initialize preference manager
		PreferenceManager.init(context);
		//initialize profile manager
		getUserProfileManager().init(context);
		
		EMClient.getInstance().callManager().getVideoCallHelper().setAdaptiveVideoFlag(getModel().isAdaptiveVideoEncode());

		setGlobalListeners();
		broadcastManager = LocalBroadcastManager.getInstance(appContext);
        initDbDao();
	}
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:32,代码来源:DemoHelper.java


示例6: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private EMOptions initChatOptions(){
        Log.d(TAG, "init HuanXin Options");
        
        EMOptions options = new EMOptions();
        // set if accept the invitation automatically
        options.setAcceptInvitationAlways(false);
        // set if you need read ack
        options.setRequireAck(true);
        // set if you need delivery ack
        options.setRequireDeliveryAck(false);

        //you need apply & set your own id if you want to use google cloud messaging.
        options.setGCMNumber("324169311137");
        //you need apply & set your own id if you want to use Mi push notification
        options.setMipushConfig("2882303761517426801", "5381742660801");
        //you need apply & set your own id if you want to use Huawei push notification
//        options.setHuaweiPushAppId("10492024");
        
        options.allowChatroomOwnerLeave(getModel().isChatroomOwnerLeaveAllowed());
        options.setDeleteMessagesAsExitGroup(getModel().isDeleteMessagesAsExitGroup());
        options.setAutoAcceptGroupInvitation(getModel().isAutoAcceptGroupInvitation());
        
        return options;
    }
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:25,代码来源:DemoHelper.java


示例7: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
protected EMOptions initChatOptions(){
        Log.d(TAG, "init HuanXin Options");
        
        // 获取到EMChatOptions对象
        EMOptions options = new EMOptions();
        // 默认添加好友时,是不需要验证的,改成需要验证
        options.setAcceptInvitationAlways(false);
        // 设置是否需要已读回执
        options.setRequireAck(true);
        // 设置是否需要已送达回执
        options.setRequireDeliveryAck(false);
        // 设置从db初始化加载时, 每个conversation需要加载msg的个数
        //options.setNumberOfMessagesLoaded(1);
        
        return options;
//        notifier.setNotificationInfoProvider(getNotificationListener());
    }
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:18,代码来源:EaseUI.java


示例8: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 * init helper
 * 
 * @param context
 *            application context
 */
public void init(Context context) {
    demoModel = new DemoModel(context);
    EMOptions options = initChatOptions();
    //options传null则使用默认的
	if (EaseUI.getInstance().init(context, options)) {
	    appContext = context;
	    
	    //设为调试模式,打成正式包时,最好设为false,以免消耗额外的资源
	    EMClient.getInstance().setDebugMode(false);
	    //get easeui instance
	    easeUI = EaseUI.getInstance();
	    //调用easeui的api设置providers
	    setEaseUIProviders();
		//初始化PreferenceManager
		PreferenceManager.init(context);
		//初始化用户管理类
		getUserProfileManager().init(context);
		
		//设置全局监听
		setGlobalListeners();
        initDbDao();
	}
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:30,代码来源:HuanXinHelper.java


示例9: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 *this function will initialize the SDK and easeUI kit
 * 
 * @return boolean true if caller can continue to call SDK related APIs after calling onInit, otherwise false.
 * 
 * @param context
 * @param options use default if options is null
 * @return
 */
public synchronized boolean init(Context context, EMOptions options){
    if(sdkInited){
        return true;
    }
    appContext = context;
    
    int pid = android.os.Process.myPid();
    String processAppName = getAppName(pid);
    
    Log.d(TAG, "process app name : " + processAppName);

    // if there is application has remote service, application:onCreate() maybe called twice
    // this check is to make sure SDK will initialized only once
    // return if process name is not application's name since the package name is the default process name
    if (processAppName == null || !processAppName.equalsIgnoreCase(appContext.getPackageName())) {
        Log.e(TAG, "enter the service process!");
        return false;
    }
    if(options == null){
        EMClient.getInstance().init(context, initChatOptions());
    }else{
        EMClient.getInstance().init(context, options);
    }
    
    initNotifier();
    registerMessageListener();
    
    if(settingsProvider == null){
        settingsProvider = new DefaultSettingsProvider();
    }
    
    sdkInited = true;
    return true;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:44,代码来源:EaseUI.java


示例10: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
protected EMOptions initChatOptions(){
    Log.d(TAG, "init HuanXin Options");

    EMOptions options = new EMOptions();
    // change to need confirm contact invitation
    options.setAcceptInvitationAlways(false);
    // set if need read ack
    options.setRequireAck(true);
    // set if need delivery ack
    options.setRequireDeliveryAck(false);
    
    return options;
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:EaseUI.java


示例11: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 *this function will initialize the SDK and easeUI kit
 *
 * @return boolean true if caller can continue to call SDK related APIs after calling onInit, otherwise false.
 *
 * @param context
 * @param options use default if options is null
 * @return
 */
public synchronized boolean init(Context context, EMOptions options){
    if(sdkInited){
        return true;
    }
    appContext = context;

    int pid = android.os.Process.myPid();
    String processAppName = getAppName(pid);

    Log.d(TAG, "process app name : " + processAppName);

    // if there is application has remote service, application:onCreate() maybe called twice
    // this check is to make sure SDK will initialized only once
    // return if process name is not application's name since the package name is the default process name
    if (processAppName == null || !processAppName.equalsIgnoreCase(appContext.getPackageName())) {
        Log.e(TAG, "enter the service process!");
        return false;
    }
    if(options == null){
        EMClient.getInstance().init(context, initChatOptions());
    }else{
        EMClient.getInstance().init(context, options);
    }

    initNotifier();
    registerMessageListener();

    if(settingsProvider == null){
        settingsProvider = new EaseUI.DefaultSettingsProvider();
    }

    sdkInited = true;
    return true;
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:44,代码来源:EaseUI.java


示例12: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
protected EMOptions initChatOptions(){
    Log.d(TAG, "init HuanXin Options");

    EMOptions options = new EMOptions();
    // change to need confirm contact invitation
    options.setAcceptInvitationAlways(false);
    // set if need read ack
    options.setRequireAck(true);
    // set if need delivery ack
    options.setRequireDeliveryAck(false);

    return options;
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:14,代码来源:EaseUI.java


示例13: initEaseUi

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private void initEaseUi() {
    EMOptions options = new EMOptions();
    // 默认添加好友时,是不需要验证的,改成需要验证
    options.setAcceptInvitationAlways(false);
    //设置自动登录,默认是true,如果不需要自动登录,这里改为false
    options.setAutoLogin(true);
    //初始化
    EMClient.getInstance().init(getApplicationContext(), options);
    //在做打包混淆时,关闭debug模式,避免消耗不必要的资源
    EMClient.getInstance().setDebugMode(true);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:12,代码来源:OverseasTribeApplication.java


示例14: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private EMOptions initChatOptions() {
    Log.d("DemoHelper", "init HuanXin Options");

    EMOptions options = new EMOptions();
    // set if accept the invitation automatically
    options.setAcceptInvitationAlways(false);
    // set if you need read ack
    options.setRequireAck(true);
    // set if you need delivery ack
    options.setRequireDeliveryAck(false);

    return options;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:14,代码来源:GApplication.java


示例15: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private EMOptions initChatOptions() {
    Log.d(TAG, "init HuanXin Options");

    EMOptions options = new EMOptions();
    // set if accept the invitation automatically
    options.setAcceptInvitationAlways(false);
    // set if you need read ack
    options.setRequireAck(true);
    // set if you need delivery ack
    options.setRequireDeliveryAck(false);

    //you need apply & set your own id if you want to use google cloud messaging.
    options.setGCMNumber("324169311137");
    //you need apply & set your own id if you want to use Mi push notification
    options.setMipushConfig("2882303761517426801", "5381742660801");
    //you need apply & set your own id if you want to use Huawei push notification
    options.setHuaweiPushAppId("10492024");

    //set custom servers, commonly used in private deployment
    if (demoModel.isCustomServerEnable() && demoModel.getRestServer() != null && demoModel.getIMServer() != null) {
        options.setRestServer(demoModel.getRestServer());
        options.setIMServer(demoModel.getIMServer());
        if (demoModel.getIMServer().contains(":")) {
            options.setIMServer(demoModel.getIMServer().split(":")[0]);
            options.setImPort(Integer.valueOf(demoModel.getIMServer().split(":")[1]));
        }
    }

    if (demoModel.isCustomAppkeyEnabled() && demoModel.getCutomAppkey() != null && !demoModel.getCutomAppkey().isEmpty()) {
        options.setAppKey(demoModel.getCutomAppkey());
    }

    options.allowChatroomOwnerLeave(getModel().isChatroomOwnerLeaveAllowed());
    options.setDeleteMessagesAsExitGroup(getModel().isDeleteMessagesAsExitGroup());
    options.setAutoAcceptGroupInvitation(getModel().isAutoAcceptGroupInvitation());

    return options;
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:DemoHelper.java


示例16: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 *this function will initialize the HuanXin SDK
 * 
 * @return boolean true if caller can continue to call HuanXin related APIs after calling onInit, otherwise false.
 * 
 * 初始化环信sdk及easeui库
 * 返回true如果正确初始化,否则false,如果返回为false,请在后续的调用中不要调用任何和环信相关的代码
 * @param context
 * @param options 聊天相关的设置,传null则使用默认的
 * @return
 */
public synchronized boolean init(Context context, EMOptions options){
    if(sdkInited){
        return true;
    }
    appContext = context;
    
    int pid = android.os.Process.myPid();
    String processAppName = getAppName(pid);
    
    Log.d(TAG, "process app name : " + processAppName);
    
    // 如果app启用了远程的service,此application:onCreate会被调用2次
    // 为了防止环信SDK被初始化2次,加此判断会保证SDK被初始化1次
    // 默认的app会在以包名为默认的process name下运行,如果查到的process name不是app的process name就立即返回
    if (processAppName == null || !processAppName.equalsIgnoreCase(appContext.getPackageName())) {
        Log.e(TAG, "enter the service process!");
        
        // 则此application::onCreate 是被service 调用的,直接返回
        return false;
    }
    if(options == null){
        EMClient.getInstance().init(context, initChatOptions());
    }else{
        EMClient.getInstance().init(context, options);
    }
    
    initNotifier();
    
    if(settingsProvider == null){
        settingsProvider = new DefaultSettingsProvider();
    }
    
    sdkInited = true;
    return true;
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:47,代码来源:EaseUI.java


示例17: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
public static void init(){
        EMOptions options = new EMOptions();
// 默认添加好友时,是不需要验证的,改成需要验证
        //options.setAcceptInvitationAlways(false);
//初始化/
        options.setAutoLogin(false);
        //EMClient.getInstance().init(MApplication.getAppContext(), options);
//在做打包混淆时,关闭debug模式,避免消耗不必要的资源
        //EMClient.getInstance().setDebugMode(true);

        EaseUI.getInstance().init(MApplication.getAppContext(),options);

    }
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:14,代码来源:HuanXinUtil.java


示例18: initOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 * 环信SDK初始化的一些配置
 * 关于 EMOptions 可以参考官方的 API 文档
 * http://www.easemob.com/apidoc/android/chat3.0/classcom_1_1hyphenate_1_1chat_1_1_e_m_options.html
 */
private EMOptions initOptions() {

	EMOptions options = new EMOptions();
	// 设置Appkey,如果配置文件已经配置,这里可以不用设置
	// options.setAppKey("lzan13#hxsdkdemo");
	// 设置自动登录
	options.setAutoLogin(true);
	// 设置是否需要发送已读回执
	options.setRequireAck(true);
	// 设置是否需要发送回执,
	options.setRequireDeliveryAck(true);
	// 设置是否需要服务器收到消息确认
	options.setRequireServerAck(true);
	// 设置是否根据服务器时间排序,默认是true
	options.setSortMessageByServerTime(false);
	// 收到好友申请是否自动同意,如果是自动同意就不会收到好友请求的回调,因为sdk会自动处理,默认为true
	options.setAcceptInvitationAlways(false);
	// 设置是否自动接收加群邀请,如果设置了当收到群邀请会自动同意加入
	options.setAutoAcceptGroupInvitation(false);
	// 设置(主动或被动)退出群组时,是否删除群聊聊天记录
	options.setDeleteMessagesAsExitGroup(false);
	// 设置是否允许聊天室的Owner 离开并删除聊天室的会话
	options.allowChatroomOwnerLeave(true);
	// 设置google GCM推送id,国内可以不用设置
	// options.setGCMNumber(MLConstants.ML_GCM_NUMBER);
	// 设置集成小米推送的appid和appkey
	// options.setMipushConfig(MLConstants.ML_MI_APP_ID, MLConstants.ML_MI_APP_KEY);

	return options;
}
 
开发者ID:starmelon,项目名称:lovelife,代码行数:36,代码来源:SplashActivity.java


示例19: init

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
/**
 *this function will initialize the HuanXin SDK
 * 
 * @return boolean true if caller can continue to call HuanXin related APIs after calling onInit, otherwise false.
 * 
 * 初始化环信sdk及easeui库
 * 返回true如果正确初始化,否则false,如果返回为false,请在后续的调用中不要调用任何和环信相关的代码
 * @param context
 * @param options 聊天相关的设置,传null则使用默认的
 * @return
 */
public synchronized boolean init(Context context, EMOptions options){
    if(sdkInited){
        return true;
    }
    appContext = context;
    
    int pid = android.os.Process.myPid();
    String processAppName = getAppName(pid);
    
    Log.d(TAG, "process app name : " + processAppName);
    
    // 如果app启用了远程的service,此application:onCreate会被调用2次
    // 为了防止环信SDK被初始化2次,加此判断会保证SDK被初始化1次
    // 默认的app会在以包名为默认的process name下运行,如果查到的process name不是app的process name就立即返回
    if (processAppName == null || !processAppName.equalsIgnoreCase(appContext.getPackageName())) {
        Log.e(TAG, "enter the service process!");
        
        // 则此application::onCreate 是被service 调用的,直接返回
        return false;
    }
    if(options == null){
        EMClient.getInstance().init(context, initChatOptions());
    }else{
        EMClient.getInstance().init(context, options);
    }
    
    initNotifier();


    if(settingsProvider == null){
        settingsProvider = new DefaultSettingsProvider();
    }
    
    sdkInited = true;
    return true;
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:48,代码来源:EaseUI.java


示例20: initChatOptions

import com.hyphenate.chat.EMOptions; //导入依赖的package包/类
private EMOptions initChatOptions(){
        Log.d(TAG, "init HuanXin Options");
        
        // 获取到EMChatOptions对象
        EMOptions options = new EMOptions();
        // 默认添加好友时,是不需要验证的,改成需要验证
        options.setAcceptInvitationAlways(false);
        // 设置是否需要已读回执
        options.setRequireAck(true);
        // 设置是否需要已送达回执
        options.setRequireDeliveryAck(false);
        // 设置从db初始化加载时, 每个conversation需要加载msg的个数
        //options.setNumberOfMessagesLoaded(1);
        
        //使用gcm和mipush时,把里面的参数替换成自己app申请的
        //设置google推送,需要的GCM的app可以设置此参数
        options.setGCMNumber("324169311137");
        //在小米手机上当app被kill时使用小米推送进行消息提示,同GCM一样不是必须的
        options.setMipushConfig("2882303761517426801", "5381742660801");
        
        options.allowChatroomOwnerLeave(getModel().isChatroomOwnerLeaveAllowed());
        options.setDeleteMessagesAsExitGroup(getModel().isDeleteMessagesAsExitGroup());
        options.setAutoAcceptGroupInvitation(getModel().isAutoAcceptGroupInvitation());
        
        return options;
//        notifier.setNotificationInfoProvider(getNotificationListener());
    }
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:28,代码来源:HuanXinHelper.java



注:本文中的com.hyphenate.chat.EMOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamBuildListener类代码示例发布时间:2022-05-22
下一篇:
Java SQLDeleteStatement类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap