56 switch(notificationPriority){
57 case NotificationCompat.PRIORITY_DEFAULT:
58 return NotificationManager.IMPORTANCE_DEFAULT;
59 case NotificationCompat.PRIORITY_HIGH:
60 return NotificationManager.IMPORTANCE_HIGH;
61 case NotificationCompat.PRIORITY_MAX:
62 return NotificationManager.IMPORTANCE_HIGH;
63 case NotificationCompat.PRIORITY_LOW:
64 return NotificationManager.IMPORTANCE_LOW;
65 case NotificationCompat.PRIORITY_MIN:
66 return NotificationManager.IMPORTANCE_MIN;
68 return NotificationManager.IMPORTANCE_DEFAULT;
75 NotificationCompat.Builder builder;
76 String mChannelId = channelId;
77 if (ZmStringUtils.isEmptyOrNull(mChannelId))
78 mChannelId = NotificationMgr.getNotificationChannelId();
79 if (ZmOsUtils.isAtLeastO()) {
80 NotificationManager notificationMgr = (NotificationManager) context.getSystemService(Activity.NOTIFICATION_SERVICE);
81 NotificationChannel notificationChannel = notificationMgr.getNotificationChannel(mChannelId);
82 if (notificationChannel ==
null) {
83 notificationChannel =
new NotificationChannel(mChannelId, context.getResources().getString(R.string.zm_notification_channel_name_43235), notificationPriority);
84 notificationChannel.enableVibration(ZmBusinessSettings.getPlayAlertVibrate());
85 if (notificationChannel.canShowBadge())
86 notificationChannel.setShowBadge(
false);
88 notificationChannel.setImportance(notificationPriority);
90 if (notificationMgr !=
null) {
91 notificationMgr.createNotificationChannel(notificationChannel);
93 builder =
new NotificationCompat.Builder(context, mChannelId);
95 builder =
new NotificationCompat.Builder(context);
104 NotificationCompat.Builder builder =
null;
105 if(ZmOsUtils.isAtLeastO()) {
106 NotificationManager notificationMgr = (NotificationManager)context
107 .getSystemService(Activity.NOTIFICATION_SERVICE);
108 NotificationChannel notificationChannel = notificationMgr.getNotificationChannel(channelId);
109 if(notificationChannel ==
null) {
110 notificationChannel =
new NotificationChannel(NotificationMgr.getNotificationChannelId(),
111 context.getResources().getString(R.string.zm_notification_channel_name_43235),notificationPriority);
112 notificationChannel.enableVibration(ZmBusinessSettings.getPlayAlertVibrate());
113 if (notificationChannel.canShowBadge())
114 notificationChannel.setShowBadge(
false);
116 notificationChannel.setImportance(notificationPriority);
118 if(notificationMgr !=
null) {
119 notificationMgr.createNotificationChannel(notificationChannel);
121 builder =
new NotificationCompat.Builder(context, NotificationMgr.getNotificationChannelId());
123 builder =
new NotificationCompat.Builder(context);
138 boolean enableShowNotification = PreferenceUtil.readBooleanValue(SDKConstants.SDK_ENABLE_CONF_NOTIFICATION,
true);
139 if (!enableShowNotification) {
143 int notificationPriority = PreferenceUtil.readIntValue(SDKConstants.SDK_MEETING_NOTIFICATION_PRIORITY, Notification.PRIORITY_DEFAULT);
144 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
145 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_CONF);
147 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context,0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
149 int contentTitleId = R.string.zm_app_name;
150 int contentTextId = R.string.zm_msg_conf_in_progress;
151 int smallIconId = R.drawable.zm_conf_notification;
152 int smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
153 int bgColorId = R.color.zm_notification_icon_bg;
154 int largeIconId = R.drawable.zm_launcher;
165 context.getDrawable(smallIconId);
166 }
catch (Exception e) {
167 smallIconId = R.drawable.zm_conf_notification;
173 context.getDrawable(smallIconForLorLaterId);
174 }
catch (Exception e) {
175 smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
184 context.getDrawable(largeIconId);
185 }
catch (Exception e) {
186 largeIconId = R.drawable.zm_launcher;
190 if (ZmOsUtils.isAtLeastL()) {
191 smallIconId = smallIconForLorLaterId;
194 IconCompat smallIcon;
196 if (SDKMeetingInterfaceHelper.isUsingDynamicFeature()) {
197 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
199 smallIcon = IconCompat.createWithResource(context, smallIconId);
201 }
catch (Exception e) {
202 if (BuildConfig.LOG_ENABLE) {
203 ZMLog.e(
"showConfNotificationForSDK", e,
"createWithResource");
205 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_conf_notification_5_0));
212 contentTitle = context.getString(contentTitleId);
213 }
catch (Exception e) {
214 contentTitle = context.getString(R.string.zm_app_name);
217 contentText = context.getString(contentTextId);
218 }
catch (Exception e) {
219 contentText = context.getString(R.string.zm_msg_conf_in_progress);
222 color = context.getResources().getColor(bgColorId);
223 }
catch (Exception e) {
224 color = context.getResources().getColor(R.color.zm_notification_icon_bg);
227 Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), largeIconId);
229 NotificationCompat.Builder builder =
null;
232 builder =
new NotificationCompat.Builder(context.getApplicationContext());
233 if (ZmOsUtils.isAtLeastO()) {
234 String channelId = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CHANNEL_ID,
"");
238 if (ZmOsUtils.isAtLeastL()) {
239 String category = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CATEGORY,
"");
240 if(!ZmStringUtils.isEmptyOrNull(category)){
241 builder.setCategory(category);
246 .setAutoCancel(
false)
248 .setSmallIcon(smallIcon)
250 .setContentTitle(contentTitle)
251 .setContentText(contentText)
252 .setOnlyAlertOnce(
true)
253 .setContentIntent(contentIntent)
254 .setPriority(notificationPriority);
257 if (ZmOsUtils.isAtLeastL() && context.getResources().getBoolean(R.bool.zm_config_show_large_icon_in_notification_on_api21_above)) {
258 builder.setLargeIcon(largeIcon);
261 Notification notification = builder.build();
263 if(context instanceof Service){
264 if (ZmOsUtils.isAtLeastU()) {
265 ((Service)context).startForeground(NotificationMgr.PT_NOTIFICATION_ID, notification, foregroundServiceType);
267 ((Service)context).startForeground(NotificationMgr.PT_NOTIFICATION_ID, notification);
272 NotificationManager notificationMgr = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
273 if (
null != notificationMgr)
274 notificationMgr.notify(NotificationMgr.PT_NOTIFICATION_ID,notification);
277 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
278 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_CONF);
280 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
282 String contentTitle = context.getString(R.string.zm_app_name);
283 String contentText = context.getString(R.string.zm_msg_conf_in_progress);
284 int smallIconId = R.drawable.zm_conf_notification;
285 if (ZmOsUtils.isAtLeastL()) {
286 smallIconId = R.drawable.zm_conf_notification_5_0;
288 IconCompat smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
290 int color = context.getResources().getColor(R.color.zm_notification_icon_bg);
292 Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_launcher);
294 NotificationCompat.Builder builder =
null;
297 if (((VideoBoxApplication)VideoBoxApplication.getInstance()).isSDKMode()) {
298 builder =
new NotificationCompat.Builder(context.getApplicationContext());
299 if (ZmOsUtils.isAtLeastO()) {
300 String channelId = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CHANNEL_ID,
"");
301 if (!ZmStringUtils.isEmptyOrNull(channelId))
303 builder.setChannelId(channelId);
305 builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext(),
false);
308 if (ZmOsUtils.isAtLeastL()) {
309 String category = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CATEGORY,
"");
310 if(!ZmStringUtils.isEmptyOrNull(category)){
311 builder.setCategory(category);
315 builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext(),
false);
319 .setAutoCancel(
false)
321 .setSmallIcon(smallIcon)
323 .setContentTitle(contentTitle)
324 .setContentText(contentText)
325 .setOnlyAlertOnce(
true)
326 .setContentIntent(contentIntent);
329 if (ZmOsUtils.isAtLeastL() && context.getResources().getBoolean(R.bool.zm_config_show_large_icon_in_notification_on_api21_above)) {
330 builder.setLargeIcon(largeIcon);
333 Notification notification = builder.build();
334 NotificationManager notificationMgr = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
336 notificationMgr.notify(NotificationMgr.PT_NOTIFICATION_ID,notification);
340 boolean enableShowNotification = PreferenceUtil.readBooleanValue(SDKConstants.SDK_ENABLE_CONF_NOTIFICATION,
true);
341 if (SDKCustomizedMeetingUIHelper.isSdkUsingCustomizedMeetingUI() || !enableShowNotification || context ==
null) {
344 NotificationManager notificationMgr = (NotificationManager) context.getSystemService(Activity.NOTIFICATION_SERVICE);
346 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
347 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_PLIST);
349 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
351 int contentTitleId = R.string.zm_app_name;
352 int smallIconId = R.drawable.zm_conf_notification;
353 int smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
354 int bgColorId = R.color.zm_notification_icon_bg;
362 context.getDrawable(smallIconId);
363 }
catch (Exception e) {
364 smallIconId = R.drawable.zm_conf_notification;
370 context.getDrawable(smallIconForLorLaterId);
371 }
catch (Exception e) {
372 smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
380 int count = userList.size();
382 contentText = context.getString(R.string.zm_waiting_room_one_entered_msg_153844, userList.get(0).getScreenName());
383 }
else if (count > 1) {
384 contentText = context.getString(R.string.zm_waiting_room_multiple_entered_msg_153844, count);
386 if (notificationMgr !=
null) {
388 notificationMgr.cancel(NotificationMgr.WAITING_ROOM_NOTIFICATION_ID);
389 }
catch (Exception e) {
390 if (BuildConfig.LOG_ENABLE)
391 ZMLog.w(
"showWaitingRoomNotificationForSDK", e,
"cancelWaitingRoomNotification exception");
397 if (ZmOsUtils.isAtLeastL()) {
398 smallIconId = smallIconForLorLaterId;
401 IconCompat smallIcon;
404 if (SDKMeetingInterfaceHelper.isUsingDynamicFeature()) {
405 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
407 smallIcon = IconCompat.createWithResource(context, smallIconId);
409 }
catch (Exception e) {
410 if (BuildConfig.LOG_ENABLE) {
411 ZMLog.e(
"showWaitingRoomNotificationForSDK", e,
"createWithResource");
413 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_conf_notification_5_0));
419 contentTitle = context.getString(contentTitleId);
420 }
catch (Exception e) {
421 contentTitle = context.getString(R.string.zm_app_name);
424 color = context.getResources().getColor(bgColorId);
425 }
catch (Exception e) {
426 color = context.getResources().getColor(R.color.zm_notification_icon_bg);
429 NotificationCompat.Builder builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext())
430 .setSmallIcon(smallIcon)
432 .setContentTitle(contentTitle)
433 .setContentText(contentText)
434 .setContentIntent(contentIntent)
435 .setPriority(NotificationCompat.PRIORITY_HIGH)
436 .setTicker(contentText)
437 .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
439 .setOnlyAlertOnce(
true);
441 Notification notification = builder.build();
442 long curTime = System.currentTimeMillis();
446 if (notificationMgr !=
null) {
448 notificationMgr.notify(NotificationMgr.WAITING_ROOM_NOTIFICATION_ID, notification);
450 }
catch (Exception e) {
451 if (BuildConfig.LOG_ENABLE)
452 ZMLog.w(
"showWaitingRoomNotificationForSDK", e,
"showWaitingRoomNotification exception");