urbanairship-core/src/main/java/com/urbanairship/push/notifications/NotificationFactory.java
protected NotificationCompat.Builder createNotificationBuilder(@NonNull PushMessage message, int notificationId, @Nullable NotificationCompat.Style defaultStyle) {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext())
                .setContentTitle(getTitle(message))
                .setContentText(message.getAlert())
                .setAutoCancel(true)
                .setLocalOnly(message.isLocalOnly())
                .setColor(message.getIconColor(getColor()))
                .setSmallIcon(message.getIcon(context, getSmallIconId()))
                .setPriority(message.getPriority())
                .setCategory(message.getCategory())
                .setVisibility(message.getVisibility());


        if (Build.VERSION.SDK_INT < 26) {
            int defaults = getNotificationDefaultOptions();

            if (message.getSound(getContext()) != null) {
                builder.setSound(message.getSound(getContext()));

                // Remove the Notification.DEFAULT_SOUND flag
                defaults &= ~Notification.DEFAULT_SOUND;
            } else if (getSound() != null) {
                builder.setSound(getSound());

                // Remove the Notification.DEFAULT_SOUND flag
                defaults &= ~Notification.DEFAULT_SOUND;
            }
            builder.setDefaults(defaults);
        }


        if (getLargeIcon() != 0) {
            builder.setLargeIcon(BitmapFactory.decodeResource(getContext().getResources(), getLargeIcon()));
        }

        if (message.getSummary() != null) {
            builder.setSubText(message.getSummary());
        }

        // Public notification
        builder.extend(new PublicNotificationExtender(getContext(), message)
                .setAccentColor(getColor())
                .setLargeIcon(getLargeIcon())
                .setSmallIcon(getSmallIconId()));


        // Wearable support
        builder.extend(new WearableNotificationExtender(getContext(), message, notificationId));

        // Notification action buttons
        builder.extend(new ActionsNotificationExtender(getContext(), message, notificationId));

        // Styles
        builder.extend(new StyleNotificationExtender(getContext(), message)
                .setDefaultStyle(defaultStyle));

        // Channels for Android O
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setChannelId(getActiveNotificationChannel(message));
        }

        return builder;
    }
/**
     * Creates a NotificationCompat.Builder with the default settings applied.
     *
     * @param message The PushMessage.
     * @param notificationId The notification id.
     * @param defaultStyle The default notification style.
     * @return A NotificationCompat.Builder.
     */
Creates a NotificationCompat.Builder with the default settings applied.
@param message The PushMessage.
@param notificationId The notification id.
@param defaultStyle The default notification style.
Creates a NotificationCompat . Builder with the default settings applied . @param message The PushMessage . @param notificationId The notification id . @param defaultStyle The default notification style .
protected NotificationCompat.Builder createNotificationBuilder(@NonNull PushMessage message, int notificationId, @Nullable NotificationCompat.Style defaultStyle) {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext())
                .setContentTitle(getTitle(message))
                .setContentText(message.getAlert())
                .setAutoCancel(true)
                .setLocalOnly(message.isLocalOnly())
                .setColor(message.getIconColor(getColor()))
                .setSmallIcon(message.getIcon(context, getSmallIconId()))
                .setPriority(message.getPriority())
                .setCategory(message.getCategory())
                .setVisibility(message.getVisibility());
        if (Build.VERSION.SDK_INT < 26) {
            int defaults = getNotificationDefaultOptions();
            if (message.getSound(getContext()) != null) {
                builder.setSound(message.getSound(getContext()));
                defaults &= ~Notification.DEFAULT_SOUND;
            } else if (getSound() != null) {
                builder.setSound(getSound());
                defaults &= ~Notification.DEFAULT_SOUND;
            }
            builder.setDefaults(defaults);
        }
        if (getLargeIcon() != 0) {
            builder.setLargeIcon(BitmapFactory.decodeResource(getContext().getResources(), getLargeIcon()));
        }
        if (message.getSummary() != null) {
            builder.setSubText(message.getSummary());
        }
        builder.extend(new PublicNotificationExtender(getContext(), message)
                .setAccentColor(getColor())
                .setLargeIcon(getLargeIcon())
                .setSmallIcon(getSmallIconId()));
        builder.extend(new WearableNotificationExtender(getContext(), message, notificationId));
        builder.extend(new ActionsNotificationExtender(getContext(), message, notificationId));
        builder.extend(new StyleNotificationExtender(getContext(), message)
                .setDefaultStyle(defaultStyle));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setChannelId(getActiveNotificationChannel(message));
        }
        return builder;
    }
protected NotificationCompat . Builder createNotificationBuilder ( @ NonNull PushMessage message , int notificationId , @ Nullable NotificationCompat . Style defaultStyle ) { NotificationCompat . Builder builder = new NotificationCompat . Builder ( getContext ( ) ) . setContentTitle ( getTitle ( message ) ) . setContentText ( message . getAlert ( ) ) . setAutoCancel ( true ) . setLocalOnly ( message . isLocalOnly ( ) ) . setColor ( message . getIconColor ( getColor ( ) ) ) . setSmallIcon ( message . getIcon ( context , getSmallIconId ( ) ) ) . setPriority ( message . getPriority ( ) ) . setCategory ( message . getCategory ( ) ) . setVisibility ( message . getVisibility ( ) ) ; if ( Build . VERSION . SDK_INT < 26 ) { int defaults = getNotificationDefaultOptions ( ) ; if ( message . getSound ( getContext ( ) ) != null ) { builder . setSound ( message . getSound ( getContext ( ) ) ) ; defaults &= ~ Notification . DEFAULT_SOUND ; } else if ( getSound ( ) != null ) { builder . setSound ( getSound ( ) ) ; defaults &= ~ Notification . DEFAULT_SOUND ; } builder . setDefaults ( defaults ) ; } if ( getLargeIcon ( ) != 0 ) { builder . setLargeIcon ( BitmapFactory . decodeResource ( getContext ( ) . getResources ( ) , getLargeIcon ( ) ) ) ; } if ( message . getSummary ( ) != null ) { builder . setSubText ( message . getSummary ( ) ) ; } builder . extend ( new PublicNotificationExtender ( getContext ( ) , message ) . setAccentColor ( getColor ( ) ) . setLargeIcon ( getLargeIcon ( ) ) . setSmallIcon ( getSmallIconId ( ) ) ) ; builder . extend ( new WearableNotificationExtender ( getContext ( ) , message , notificationId ) ) ; builder . extend ( new ActionsNotificationExtender ( getContext ( ) , message , notificationId ) ) ; builder . extend ( new StyleNotificationExtender ( getContext ( ) , message ) . setDefaultStyle ( defaultStyle ) ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . O ) { builder . setChannelId ( getActiveNotificationChannel ( message ) ) ; } return builder ; }
Creates a NotificationCompat.Builder with the default settings applied.
Creates a NotificationCompat . Builder with the default settings applied .
// Remove the Notification.DEFAULT_SOUND flag // Remove the Notification.DEFAULT_SOUND flag // Public notification // Wearable support // Notification action buttons // Styles // Channels for Android O