public class

DefaultNotificationFactory

extends NotificationFactory
java.lang.Object
   ↳ com.urbanairship.push.notifications.NotificationFactory
     ↳ com.urbanairship.push.notifications.DefaultNotificationFactory

Class Overview

The default notification factory.

Notifications generated by this factory use the standard Android notification layout and defaults to the BigTextStyle.

To customize the factory, override extendBuilder(NotificationCompat.Builder, PushMessage, int).

Summary

Public Constructors
DefaultNotificationFactory(Context context)
Default constructor.
Public Methods
final Notification createNotification(PushMessage message, int notificationId)
Creates a Notification for an incoming push message.
NotificationCompat.Builder extendBuilder(NotificationCompat.Builder builder, PushMessage message, int notificationId)
Called to apply any final overrides to the builder before the notification is built.
[Expand]
Inherited Methods
From class com.urbanairship.push.notifications.NotificationFactory
From class java.lang.Object

Public Constructors

public DefaultNotificationFactory (Context context)

Default constructor.

Parameters
context The application context

Public Methods

public final Notification createNotification (PushMessage message, int notificationId)

Creates a Notification for an incoming push message.

In order to handle notification opens, the application should register a broadcast receiver that extends AirshipReceiver. When the notification is opened it will call onNotificationOpened(Context, AirshipReceiver.NotificationInfo) giving the application a chance to handle the notification open. If the broadcast receiver is not registered, or false is returned, an open will be handled by either starting the launcher activity or by sending the notification's content intent if it is present.

Parameters
message The push message.
notificationId The notification ID.
Returns
  • The notification to display, or null if no notification is desired.

public NotificationCompat.Builder extendBuilder (NotificationCompat.Builder builder, PushMessage message, int notificationId)

Called to apply any final overrides to the builder before the notification is built.

Parameters
builder The notification builder.
message The push message.
notificationId The notification ID.
Returns
  • The notification builder.