本文整理汇总了Java中com.hyphenate.chat.EMOptions类的典型用法代码示例。如果您正苦于以下问题:Java EMOptions类的具体用法?Java EMOptions怎么用?Java EMOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMOptions类属于com.hyphenate.chat包,在下文中一共展示了EMOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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);
}
示例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());
}
示例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();
}
}
示例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;
}
示例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());
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}