public class

AirshipNotificationProvider

extends Object
implements NotificationProvider
java.lang.Object
   ↳ com.urbanairship.push.notifications.AirshipNotificationProvider
Known Direct Subclasses

Class Overview

Default notification provider.

Summary

Constants
int TAG_NOTIFICATION_ID Default Notification ID when the PushMessage defines a notification tag.
[Expand]
Inherited Constants
From interface com.urbanairship.push.notifications.NotificationProvider
Public Constructors
AirshipNotificationProvider(Context context, AirshipConfigOptions configOptions)
Public Methods
int getDefaultAccentColor()
Get the default accent color.
String getDefaultNotificationChannelId()
Gets the default notification channel.
int getDefaultTitle()
Get the default notification title string resource.
int getLargeIcon()
Get the large icon drawable resource.
int getSmallIcon()
Get the small icon drawable resource.
NotificationResult onCreateNotification(Context context, NotificationArguments arguments)
Called to generate the NotificationResult for a push message.
NotificationArguments onCreateNotificationArguments(Context context, PushMessage message)
Called to generate the NotificationArguments for a push message.
void onNotificationCreated(Context context, Notification notification, NotificationArguments arguments)
Called before posting the notification.
void setDefaultAccentColor(int accentColor)
Set the default notification accent color.
void setDefaultNotificationChannelId(String channel)
Sets the default notification channel.
void setDefaultTitle(int titleId)
Set the default notification title.
void setLargeIcon(int largeIcon)
Set the notification large icon.
void setSmallIcon(int smallIconId)
Set the notification small icon.
Protected Methods
int getNextId(Context context, PushMessage message)
Gets the next notification Id.
String getTitle(Context context, PushMessage message)
Gets the notification title.
NotificationCompat.Builder onExtendBuilder(Context context, NotificationCompat.Builder builder, NotificationArguments arguments)
Override this method to extend the notification builder.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.push.notifications.NotificationProvider

Constants

public static final int TAG_NOTIFICATION_ID

Default Notification ID when the PushMessage defines a notification tag.

Constant Value: 100 (0x00000064)

Public Constructors

public AirshipNotificationProvider (Context context, AirshipConfigOptions configOptions)

Public Methods

public int getDefaultAccentColor ()

Get the default accent color.

Returns
  • The accent color as an int.

public String getDefaultNotificationChannelId ()

Gets the default notification channel.

Returns
  • The default notification channel.

public int getDefaultTitle ()

Get the default notification title string resource.

Returns
  • The title string resource.

public int getLargeIcon ()

Get the large icon drawable resource.

Returns
  • The large icon drawable resource.

public int getSmallIcon ()

Get the small icon drawable resource. Defaults to the application's icon.

Returns
  • The small icon drawable resource.

public NotificationResult onCreateNotification (Context context, NotificationArguments arguments)

Called to generate the NotificationResult for a push message.

Parameters
context The context.
arguments The arguments from onCreateNotificationArguments(Context, PushMessage).
Returns
  • The notification result.

public NotificationArguments onCreateNotificationArguments (Context context, PushMessage message)

Called to generate the NotificationArguments for a push message.

Parameters
context The context.
message The message.
Returns
  • The notification arguments.

public void onNotificationCreated (Context context, Notification notification, NotificationArguments arguments)

Called before posting the notification. The notification will have settings applied from an associated NotificationChannelCompat on pre-O devices Use this method to apply any global overrides to the notification.

Parameters
context The context.
notification The notification.
arguments The notification arguments.

public void setDefaultAccentColor (int accentColor)

Set the default notification accent color.

Parameters
accentColor The accent color.

public void setDefaultNotificationChannelId (String channel)

Sets the default notification channel.

Parameters
channel The default notification channel.

public void setDefaultTitle (int titleId)

Set the default notification title.

Parameters
titleId The title string resource. A value of 0 will result in no default title.

public void setLargeIcon (int largeIcon)

Set the notification large icon.

Parameters
largeIcon The large icon drawable resource.

public void setSmallIcon (int smallIconId)

Set the notification small icon.

Parameters
smallIconId The small icon drawable resource.

Protected Methods

protected int getNextId (Context context, PushMessage message)

Gets the next notification Id.

Parameters
context The application context.
message The push message.
Returns
  • The notification Id.

protected String getTitle (Context context, PushMessage message)

Gets the notification title.

Parameters
context The application context.
message The push message.
Returns
  • The notification title.

protected NotificationCompat.Builder onExtendBuilder (Context context, NotificationCompat.Builder builder, NotificationArguments arguments)

Override this method to extend the notification builder. The default method behavior applies extends the builder with PublicNotificationExtender, WearableNotificationExtender, ActionsNotificationExtender, and StyleNotificationExtender.

Parameters
context The application context.
builder The notification builder.
arguments The notification arguments.
Returns
  • The notification builder.