当前位置: 首页>>代码示例>>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;未经允许,请勿转载。