當前位置: 首頁>>代碼示例>>Java>>正文


Java NotificationManager.IMPORTANCE_NONE屬性代碼示例

本文整理匯總了Java中android.app.NotificationManager.IMPORTANCE_NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotificationManager.IMPORTANCE_NONE屬性的具體用法?Java NotificationManager.IMPORTANCE_NONE怎麽用?Java NotificationManager.IMPORTANCE_NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.app.NotificationManager的用法示例。


在下文中一共展示了NotificationManager.IMPORTANCE_NONE屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: NotificationChannelData

NotificationChannelData(Map<String, Object> channel) {
  id = (String) channel.get("id");
  name = (String) channel.get("name");
  description = (String) channel.get("description");
  groupId = (String) channel.get("groupId");

  importance = (int) CollectionUtil.getOrDefault(channel, "importance",
      importance);
  enableLights = (boolean) CollectionUtil.getOrDefault(channel, "enable_lights", enableLights);
  lightColor = (int) CollectionUtil.getOrDefault(channel, "light_color", lightColor);
  enableVibration = (boolean) CollectionUtil.getOrDefault(channel, "enable_vibration",
      enableVibration);
  lockscreenVisibility = (int) CollectionUtil.getOrDefault(channel, "lockscreen_visibility",
      lockscreenVisibility);
  bypassDnd = (boolean) CollectionUtil.getOrDefault(channel, "bypass_dnd", bypassDnd);
  showBadge = (boolean) CollectionUtil.getOrDefault(channel, "show_badge", showBadge);

  try {
    List<Number> pattern = CollectionUtil.uncheckedCast(
        CollectionUtil.getOrDefault(channel, "vibration_pattern", null));
    if (pattern != null) {
      vibrationPattern = new long[pattern.size()];
      Iterator<Number> iterator = pattern.iterator();
      for (int i = 0; i < vibrationPattern.length; i++) {
        Number next = iterator.next();
        if (next != null) {
          vibrationPattern[i] = next.longValue();
        }
      }
    }
  } catch (Exception e) {
    Log.w("Failed to parse vibration pattern.");
  }

  // Sanity checks.
  if (importance < NotificationManager.IMPORTANCE_NONE &&
      importance > NotificationManager.IMPORTANCE_MAX) {
    importance = NotificationManager.IMPORTANCE_DEFAULT;
  }
  if (lockscreenVisibility < Notification.VISIBILITY_SECRET &&
      lockscreenVisibility > Notification.VISIBILITY_PUBLIC) {
    lockscreenVisibility = Notification.VISIBILITY_PUBLIC;
  }
}
 
開發者ID:Leanplum,項目名稱:Leanplum-Android-SDK,代碼行數:44,代碼來源:LeanplumNotificationChannel.java


注:本文中的android.app.NotificationManager.IMPORTANCE_NONE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。