78 NotificationCompat.Builder builder;
79 String mChannelId = channelId;
80 if (ZmStringUtils.isEmptyOrNull(mChannelId))
81 mChannelId = NotificationMgr.getNotificationChannelId();
82 if (ZmOsUtils.isAtLeastO()) {
83 NotificationManager notificationMgr = (NotificationManager) context.getSystemService(Activity.NOTIFICATION_SERVICE);
84 NotificationChannel notificationChannel = notificationMgr.getNotificationChannel(mChannelId);
85 if (notificationChannel ==
null) {
86 notificationChannel =
new NotificationChannel(mChannelId, context.getResources().getString(R.string.zm_notification_channel_name_43235), notificationPriority);
87 notificationChannel.enableVibration(ZmBusinessSettings.getPlayAlertVibrate());
88 if (notificationChannel.canShowBadge())
89 notificationChannel.setShowBadge(
false);
91 notificationChannel.setImportance(notificationPriority);
93 if (notificationMgr !=
null) {
94 notificationMgr.createNotificationChannel(notificationChannel);
96 builder =
new NotificationCompat.Builder(context, mChannelId);
98 builder =
new NotificationCompat.Builder(context);
107 NotificationCompat.Builder builder =
null;
108 if(ZmOsUtils.isAtLeastO()) {
109 NotificationManager notificationMgr = (NotificationManager)context
110 .getSystemService(Activity.NOTIFICATION_SERVICE);
111 NotificationChannel notificationChannel = notificationMgr.getNotificationChannel(channelId);
112 if(notificationChannel ==
null) {
113 notificationChannel =
new NotificationChannel(NotificationMgr.getNotificationChannelId(),
114 context.getResources().getString(R.string.zm_notification_channel_name_43235),notificationPriority);
115 notificationChannel.enableVibration(ZmBusinessSettings.getPlayAlertVibrate());
116 if (notificationChannel.canShowBadge())
117 notificationChannel.setShowBadge(
false);
119 notificationChannel.setImportance(notificationPriority);
121 if(notificationMgr !=
null) {
122 notificationMgr.createNotificationChannel(notificationChannel);
124 builder =
new NotificationCompat.Builder(context, NotificationMgr.getNotificationChannelId());
126 builder =
new NotificationCompat.Builder(context);
141 boolean enableShowNotification = PreferenceUtil.readBooleanValue(SDKConstants.SDK_ENABLE_CONF_NOTIFICATION,
true);
142 if (!enableShowNotification) {
146 int notificationPriority = PreferenceUtil.readIntValue(SDKConstants.SDK_MEETING_NOTIFICATION_PRIORITY, Notification.PRIORITY_DEFAULT);
147 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
148 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_CONF);
150 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context,0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
152 int contentTitleId = R.string.zm_app_name;
153 int contentTextId = R.string.zm_msg_conf_in_progress;
154 int smallIconId = R.drawable.zm_conf_notification;
155 int smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
156 int bgColorId = R.color.zm_notification_icon_bg;
157 int largeIconId = R.drawable.zm_launcher;
160 contentTitleId =
mNotifData.getContentTitleId();
163 contentTextId =
mNotifData.getContentTextId();
168 context.getDrawable(smallIconId);
169 }
catch (Exception e) {
170 smallIconId = R.drawable.zm_conf_notification;
173 if(
mNotifData.getSmallIconForLorLaterId() != 0) {
174 smallIconForLorLaterId =
mNotifData.getSmallIconForLorLaterId();
176 context.getDrawable(smallIconForLorLaterId);
177 }
catch (Exception e) {
178 smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
187 context.getDrawable(largeIconId);
188 }
catch (Exception e) {
189 largeIconId = R.drawable.zm_launcher;
193 if (ZmOsUtils.isAtLeastL()) {
194 smallIconId = smallIconForLorLaterId;
197 IconCompat smallIcon;
199 if (SDKMeetingInterfaceHelper.isUsingDynamicFeature()) {
200 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
202 smallIcon = IconCompat.createWithResource(context, smallIconId);
204 }
catch (Exception e) {
205 if (BuildConfig.LOG_ENABLE) {
206 ZMLog.e(
"showConfNotificationForSDK", e,
"createWithResource");
208 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_conf_notification_5_0));
215 contentTitle = context.getString(contentTitleId);
216 }
catch (Exception e) {
217 contentTitle = context.getString(R.string.zm_app_name);
220 contentText = context.getString(contentTextId);
221 }
catch (Exception e) {
222 contentText = context.getString(R.string.zm_msg_conf_in_progress);
225 color = context.getResources().getColor(bgColorId);
226 }
catch (Exception e) {
227 color = context.getResources().getColor(R.color.zm_notification_icon_bg);
230 Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), largeIconId);
232 NotificationCompat.Builder builder =
null;
235 builder =
new NotificationCompat.Builder(context.getApplicationContext());
236 if (ZmOsUtils.isAtLeastO()) {
237 String channelId = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CHANNEL_ID,
"");
241 if (ZmOsUtils.isAtLeastL()) {
242 String category = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CATEGORY,
"");
243 if(!ZmStringUtils.isEmptyOrNull(category)){
244 builder.setCategory(category);
249 .setAutoCancel(
false)
251 .setSmallIcon(smallIcon)
253 .setContentTitle(contentTitle)
254 .setContentText(contentText)
255 .setOnlyAlertOnce(
true)
256 .setContentIntent(contentIntent)
257 .setPriority(notificationPriority);
260 if (ZmOsUtils.isAtLeastL() && context.getResources().getBoolean(R.bool.zm_config_show_large_icon_in_notification_on_api21_above)) {
261 builder.setLargeIcon(largeIcon);
264 Notification notification = builder.build();
266 if(context instanceof Service){
267 if (ZmOsUtils.isAtLeastU()) {
268 ((Service)context).startForeground(NotificationMgr.PT_NOTIFICATION_ID, notification, foregroundServiceType);
270 ((Service)context).startForeground(NotificationMgr.PT_NOTIFICATION_ID, notification);
275 NotificationManager notificationMgr = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
276 if (
null != notificationMgr)
277 notificationMgr.notify(NotificationMgr.PT_NOTIFICATION_ID,notification);
280 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
281 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_CONF);
283 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
285 String contentTitle = context.getString(R.string.zm_app_name);
286 String contentText = context.getString(R.string.zm_msg_conf_in_progress);
287 int smallIconId = R.drawable.zm_conf_notification;
288 if (ZmOsUtils.isAtLeastL()) {
289 smallIconId = R.drawable.zm_conf_notification_5_0;
291 IconCompat smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
293 int color = context.getResources().getColor(R.color.zm_notification_icon_bg);
295 Bitmap largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_launcher);
297 NotificationCompat.Builder builder =
null;
300 if (((VideoBoxApplication)VideoBoxApplication.getInstance()).isSDKMode()) {
301 builder =
new NotificationCompat.Builder(context.getApplicationContext());
302 if (ZmOsUtils.isAtLeastO()) {
303 String channelId = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CHANNEL_ID,
"");
304 if (!ZmStringUtils.isEmptyOrNull(channelId))
306 builder.setChannelId(channelId);
308 builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext(),
false);
311 if (ZmOsUtils.isAtLeastL()) {
312 String category = PreferenceUtil.readStringValue(SDKConstants.SDK_CONF_NOTIFICATION_CATEGORY,
"");
313 if(!ZmStringUtils.isEmptyOrNull(category)){
314 builder.setCategory(category);
318 builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext(),
false);
322 .setAutoCancel(
false)
324 .setSmallIcon(smallIcon)
326 .setContentTitle(contentTitle)
327 .setContentText(contentText)
328 .setOnlyAlertOnce(
true)
329 .setContentIntent(contentIntent);
332 if (ZmOsUtils.isAtLeastL() && context.getResources().getBoolean(R.bool.zm_config_show_large_icon_in_notification_on_api21_above)) {
333 builder.setLargeIcon(largeIcon);
336 Notification notification = builder.build();
337 NotificationManager notificationMgr = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
339 notificationMgr.notify(NotificationMgr.PT_NOTIFICATION_ID,notification);
343 boolean enableShowNotification = PreferenceUtil.readBooleanValue(SDKConstants.SDK_ENABLE_CONF_NOTIFICATION,
true);
344 if (SDKCustomizedMeetingUIHelper.isSdkUsingCustomizedMeetingUI() || !enableShowNotification || context ==
null) {
347 NotificationManager notificationMgr = (NotificationManager) context.getSystemService(Activity.NOTIFICATION_SERVICE);
349 Intent clickIntent =
new Intent(context, IntegrationActivity.class);
350 clickIntent.setAction(ZmIntegrationActionType.ACTION_RETURN_TO_PLIST);
352 PendingIntent contentIntent = ZmIntentUtils.getPendingIntentActivity(context, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
354 int contentTitleId = R.string.zm_app_name;
355 int smallIconId = R.drawable.zm_conf_notification;
356 int smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
357 int bgColorId = R.color.zm_notification_icon_bg;
360 contentTitleId =
mNotifData.getContentTitleId();
365 context.getDrawable(smallIconId);
366 }
catch (Exception e) {
367 smallIconId = R.drawable.zm_conf_notification;
370 if(
mNotifData.getSmallIconForLorLaterId() != 0) {
371 smallIconForLorLaterId =
mNotifData.getSmallIconForLorLaterId();
373 context.getDrawable(smallIconForLorLaterId);
374 }
catch (Exception e) {
375 smallIconForLorLaterId = R.drawable.zm_conf_notification_5_0;
383 int count = userList.size();
385 contentText = context.getString(R.string.zm_waiting_room_one_entered_msg_153844, userList.get(0).getScreenName());
386 }
else if (count > 1) {
387 contentText = context.getString(R.string.zm_waiting_room_multiple_entered_msg_153844, count);
389 if (notificationMgr !=
null) {
391 notificationMgr.cancel(NotificationMgr.WAITING_ROOM_NOTIFICATION_ID);
392 }
catch (Exception e) {
393 if (BuildConfig.LOG_ENABLE)
394 ZMLog.w(
"showWaitingRoomNotificationForSDK", e,
"cancelWaitingRoomNotification exception");
400 if (ZmOsUtils.isAtLeastL()) {
401 smallIconId = smallIconForLorLaterId;
404 IconCompat smallIcon;
407 if (SDKMeetingInterfaceHelper.isUsingDynamicFeature()) {
408 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), smallIconId));
410 smallIcon = IconCompat.createWithResource(context, smallIconId);
412 }
catch (Exception e) {
413 if (BuildConfig.LOG_ENABLE) {
414 ZMLog.e(
"showWaitingRoomNotificationForSDK", e,
"createWithResource");
416 smallIcon = IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.zm_conf_notification_5_0));
422 contentTitle = context.getString(contentTitleId);
423 }
catch (Exception e) {
424 contentTitle = context.getString(R.string.zm_app_name);
427 color = context.getResources().getColor(bgColorId);
428 }
catch (Exception e) {
429 color = context.getResources().getColor(R.color.zm_notification_icon_bg);
432 NotificationCompat.Builder builder = NotificationMgr.getNotificationCompatBuilder(context.getApplicationContext())
433 .setSmallIcon(smallIcon)
435 .setContentTitle(contentTitle)
436 .setContentText(contentText)
437 .setContentIntent(contentIntent)
438 .setPriority(NotificationCompat.PRIORITY_HIGH)
439 .setTicker(contentText)
440 .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
442 .setOnlyAlertOnce(
true);
444 Notification notification = builder.build();
445 long curTime = System.currentTimeMillis();
449 if (notificationMgr !=
null) {
451 notificationMgr.notify(NotificationMgr.WAITING_ROOM_NOTIFICATION_ID, notification);
453 }
catch (Exception e) {
454 if (BuildConfig.LOG_ENABLE)
455 ZMLog.w(
"showWaitingRoomNotificationForSDK", e,
"showWaitingRoomNotification exception");