当前位置: 首页>>代码示例>>Java>>正文


Java Notification.PRIORITY_MIN属性代码示例

本文整理汇总了Java中android.app.Notification.PRIORITY_MIN属性的典型用法代码示例。如果您正苦于以下问题:Java Notification.PRIORITY_MIN属性的具体用法?Java Notification.PRIORITY_MIN怎么用?Java Notification.PRIORITY_MIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.app.Notification的用法示例。


在下文中一共展示了Notification.PRIORITY_MIN属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPersistentNotification

public Notification getPersistentNotification() {
    PendingIntent pendingIntent = PendingIntent.getBroadcast(this.context, 0, new Intent(INTENT_ACTION_LAUNCH_SHADE), 0);
    RemoteViews content = new RemoteViews(BuildConfig.APPLICATION_ID, R.layout.persistent_notification);
    String notificationTitle = this.context.getResources().getString(R.string.persistent_notification_title);
    String notificationContent = this.context.getResources().getString(R.string.persistent_notification_text);
    int priority = Integer.MIN_VALUE;
    int smallIconId = 17170445;
    long when = Long.MIN_VALUE;
    if (this.hasPendingMessages) {
        notificationContent = this.context.getResources().getString(R.string.persistent_notification_with_messages_text);
        if (VERSION.SDK_INT <= 19) {
            priority = 1;
        }
        if (!(this.lockScreenManager.isPhoneLocked() || this.lockScreenManager.isScreenOff())) {
            when = System.currentTimeMillis();
            priority = 1;
        }
        smallIconId = R.drawable.ic_notification_small;
    }
    priority=Notification.PRIORITY_MIN;
   // builder.setPriority(Notification.PRIORITY_MIN);
    content.setTextViewText(R.id.notification_title_textview, notificationTitle);
    content.setTextViewText(R.id.notification_content_textview, notificationContent);
    return new Builder(this.context).setPriority(priority).setContentIntent(pendingIntent).setSmallIcon(smallIconId).setContent(content).setWhen(when).setOngoing(true).build();
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:25,代码来源:NotificationTrayManager.java

示例2: onNotificationPosted

@Override
public void onNotificationPosted(final StatusBarNotification notification) {
    if (!notification.getPackageName().equals("android")
            && (!ignoreLowPriority || notification
            .getNotification().priority > Notification.PRIORITY_MIN)
            && (!ignoreOnGoing || !notification.isOngoing())) {
        long current = System.currentTimeMillis();
        String pkg = notification.getPackageName();
        if (current - lastTime < TIME_THRESHOLD && lastPackage.equals(pkg)) {
            if (BuildConfig.DEBUG)
                Logger.log("ignore duplicate notification from " + pkg);
            return;
        }
        ConnectivityManager cm =
                (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
        boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
        if (isWiFi) {
            lastTime = current;
            lastPackage = pkg;
            Collection<String> people = null;
            if (Build.VERSION.SDK_INT >= 19) {
                people = notification
                        .getNotification().extras.getStringArrayList(Notification.EXTRA_PEOPLE);
            }
            if (BuildConfig.DEBUG)
                Logger.log(
                        "received notification from " + lastPackage + ", people=" + people);
            Database db = Database.getInstance(this);
            if (db.contains(lastPackage)) {
                String pattern = db.getPattern(lastPackage, people);
                startService(new Intent(this, ColorFlashService.class)
                        .putExtra("lights", Util.getLights(pattern))
                        .putExtra("colors", Util.getColors(pattern)));
            }
            db.close();
        } else if (BuildConfig.DEBUG) {
            Logger.log("Not connected to WiFi network --> ignore");
        }
    }
}
 
开发者ID:j4velin,项目名称:HueNotifier,代码行数:41,代码来源:NotificationListener.java


注:本文中的android.app.Notification.PRIORITY_MIN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。