java.lang.Object | ||
↳ | com.urbanairship.push.notifications.NotificationFactory | |
↳ | com.urbanairship.push.notifications.DefaultNotificationFactory |
![]() |
The default notification factory.
Notifications generated by this factory use the standard Android notification layout and defaults to the BigTextStyle.Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DefaultNotificationFactory(Context context) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notification |
createNotification(PushMessage message, int notificationId)
Creates a
Notification for an incoming push message. | ||||||||||
int |
getColor()
Get the accent color used in the notification.
| ||||||||||
int |
getConstantNotificationId()
Get the constant notification ID.
| ||||||||||
int |
getLargeIcon()
Get the large icon used in the notification layout.
| ||||||||||
int |
getNextId(PushMessage pushMessage)
Creates a notification ID based on the message and payload.
| ||||||||||
int |
getSmallIconId()
Get the small icon used in the notification layout.
| ||||||||||
Uri |
getSound()
Get the sound played when the notification arrives.
| ||||||||||
int |
getTitleId()
Get the title used in the notification layout.
| ||||||||||
void |
setColor(int accentColor)
Set the accent color used in the notification.
| ||||||||||
void |
setConstantNotificationId(int id)
Set the optional constant notification ID.
| ||||||||||
void |
setLargeIcon(int largeIcon)
Set the large icon used in the notification layout.
| ||||||||||
void |
setSmallIconId(int smallIconId)
Set the small icon used in the notification layout.
| ||||||||||
void |
setSound(Uri sound)
Set the sound played when the notification arrives.
| ||||||||||
void |
setTitleId(int titleId)
Set the title used in the notification layout.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NotificationCompat.Builder |
createNotificationBuilder(PushMessage message, int notificationId, NotificationCompat.Style defaultStyle)
Creates a NotificationCompat.Builder with the default settings applied.
| ||||||||||
String |
getDefaultTitle()
Gets the default title for the notification.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates a Notification
for an incoming push message.
BaseIntentReceiver
. When the notification is opened
it will call onNotificationOpened(Context, PushMessage, int)
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.message | The push message. |
---|---|
notificationId | The notification ID. |
null
if no notification is desired.
Get the accent color used in the notification.
Get the constant notification ID.
Get the large icon used in the notification layout.
Creates a notification ID based on the message and payload.
This method could return a constant (to always replace the existing ID) or a payload/message specific ID (to replace in cases where there are duplicates, for example) or a random/sequential (to always add a new notification).pushMessage | The push message. |
---|
Get the small icon used in the notification layout.
Get the sound played when the notification arrives.
Get the title used in the notification layout.
Set the accent color used in the notification.
accentColor | The accent color of the main notification icon. |
---|
Set the optional constant notification ID.
id | The integer ID as an int. |
---|
Set the large icon used in the notification layout.
largeIcon | The large icon ID as an int. |
---|
Set the small icon used in the notification layout.
smallIconId | The small icon ID as an int. |
---|
Set the sound played when the notification arrives.
sound | The sound as a Uri. |
---|
Set the title used in the notification layout.
titleId | The title as an int. A value of -1 will not display a title. A value of 0 will display the application name as the title. A string resource ID will display the specified string as the title. |
---|
Creates a NotificationCompat.Builder with the default settings applied.
message | The PushMessage. |
---|---|
notificationId | The notification id. |
defaultStyle | The default notification style. |
Gets the default title for the notification. If the getTitleId()
is 0,
the application label will be used, if greater than 0 the string will be fetched
from the resources, and if negative an empty String