Notification.Builder PendingIntent

设置FullScreenIntent:

 /**
         * An intent to launch instead of posting the notification to the status bar.
         * Only for use with extremely high-priority notifications demanding the user's
         * <strong>immediate</strong> attention, such as an incoming phone call or
         * alarm clock that the user has explicitly set to a particular time.
         * If this facility is used for something else, please give the user an option
         * to turn it off and use a normal notification, as this can be extremely
         * disruptive.
         *
         * @param intent The pending intent to launch.
         * @param highPriority Passing true will cause this notification to be sent
         *          even if other notifications are suppressed.
         */
        public Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {
            mFullScreenIntent = intent;
            setFlag(FLAG_HIGH_PRIORITY, highPriority);
            return this;
        }

一个全屏状态下替代状态栏上的Notification的intent,仅适用于使用非常高的优先级通知,会引起用户的即时关注,如用户已显式设置为一个特定的时间,一个来电或闹钟。

 builder.setFullScreenIntent(inCallPendingIntent, true);

设置 FullScreenIntent后,会立即响应该Intent ,而不会等待用户去手动触发。参看源码 Phone app 下面的NotificationMgr.java 的updateInCallNotification() 方法的设置



你可能感兴趣的:(Notification.Builder PendingIntent)