java.lang.Object | ||
↳ | com.urbanairship.AirshipComponent | |
↳ | com.urbanairship.push.PushManager |
This class is the primary interface for customizing the display and behavior of incoming push notifications.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | EXTRA_NOTIFICATION_ID | The notification ID extra contains the ID of the notification placed in the
NotificationManager by the library. |
|||||||||
String | EXTRA_NOTIFICATION_TAG | The notification tag extra contains the tag of the notification placed in the
NotificationManager by the library. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.urbanairship.AirshipComponent
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addNotificationActionButtonGroup(String id, NotificationActionButtonGroup group)
Register a notification action group under the given name.
| ||||||||||
void |
addNotificationActionButtonGroups(Context context, int resId)
Adds notification action button groups from an xml file.
| ||||||||||
void |
addNotificationStatusListener(PushNotificationStatusListener listener)
Adds an Airship push notification status listener.
| ||||||||||
void |
addPushListener(PushListener listener)
Adds a push listener.
| ||||||||||
void |
addPushTokenListener(PushTokenListener listener)
Adds a push token listener.
| ||||||||||
boolean |
areNotificationsOptedIn()
Checks if notifications are enabled for the app and in the push manager.
| ||||||||||
Predicate<PushMessage> |
getForegroundNotificationDisplayPredicate()
Gets the foreground notification display predicate.
| ||||||||||
String |
getLastReceivedMetadata()
Returns the send metadata of the last received push.
| ||||||||||
NotificationActionButtonGroup |
getNotificationActionGroup(String id)
Returns the notification action group that is registered under the given name.
| ||||||||||
NotificationChannelRegistry |
getNotificationChannelRegistry()
Returns the shared notification channel registry.
| ||||||||||
NotificationListener |
getNotificationListener()
Gets the notification listener.
| ||||||||||
NotificationProvider |
getNotificationProvider()
Gets the notification provider.
| ||||||||||
PushNotificationStatus |
getPushNotificationStatus()
Returns the current Airship push notification status.
| ||||||||||
PushProviderType |
getPushProviderType()
Gets the PushProviderType corresponding to the current push provider.
| ||||||||||
String |
getPushToken()
Gets the push token.
| ||||||||||
Date[] |
getQuietTimeInterval()
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
boolean |
getUserNotificationsEnabled()
Determines whether user-facing push notifications are enabled.
| ||||||||||
boolean |
isInQuietTime()
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
boolean |
isOptIn()
Returns if the application is currently opted in for push.
| ||||||||||
boolean |
isPushAvailable()
Determines whether the app is capable of receiving push,
meaning whether a FCM or ADM push token is present.
| ||||||||||
boolean |
isQuietTimeEnabled()
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
boolean |
isSoundEnabled()
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
boolean |
isVibrateEnabled()
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
void |
removeNotificationActionButtonGroup(String id)
Removes the notification button group under the given name.
| ||||||||||
void |
removeNotificationStatusListener(PushNotificationStatusListener listener)
Removes an Airship push notification status listener.
| ||||||||||
void |
removePushListener(PushListener listener)
Removes a push listener.
| ||||||||||
void |
removePushTokenListener(PushTokenListener listener)
Removes a push token listener.
| ||||||||||
void |
setForegroundNotificationDisplayPredicate(Predicate<PushMessage> foregroundDisplayPredicate)
Sets a predicate that determines if a notification should be presented in the foreground or not.
| ||||||||||
void |
setNotificationListener(NotificationListener listener)
Sets the notification listener.
| ||||||||||
void |
setNotificationProvider(NotificationProvider provider)
Sets the notification provider used to build notifications from a push message
If | ||||||||||
void |
setQuietTimeEnabled(boolean enabled)
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
void |
setQuietTimeInterval(Date startTime, Date endTime)
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
void |
setSoundEnabled(boolean enabled)
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
| ||||||||||
void |
setUserNotificationsEnabled(boolean enabled)
Enables or disables user notifications.
| ||||||||||
void |
setVibrateEnabled(boolean enabled)
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use
NotificationChannelCompat instead.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
init()
Initialize the manager.
| ||||||||||
void |
onAirshipReady(UAirship airship)
Called when airship instance is ready.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The notification ID extra contains the ID of the notification placed in the
NotificationManager
by the library.
If a Notification
was not created, the extra will not be included.
The notification tag extra contains the tag of the notification placed in the
NotificationManager
by the library.
If a Notification
was not created, the extra will not be included.
Register a notification action group under the given name.
The provided notification builders will automatically add the actions to the
notification when a message is received with a group specified under the
EXTRA_INTERACTIVE_TYPE
key.
id | The id of the action group. |
---|---|
group | The notification action group. |
Adds notification action button groups from an xml file. Example entry:
<UrbanAirshipActionButtonGroup id="custom_group">
<UrbanAirshipActionButton
foreground="true"
id="yes"
android:icon="@drawable/ua_ic_notification_button_accept"
android:label="@string/ua_notification_button_yes"/>
<UrbanAirshipActionButton
foreground="false"
id="no"
android:icon="@drawable/ua_ic_notification_button_decline"
android:label="@string/ua_notification_button_no"/>
</UrbanAirshipActionButtonGroup>
context | The application context. |
---|---|
resId | The xml resource ID. |
Adds an Airship push notification status listener.
listener | The listener. |
---|
Adds a push listener.
listener | The push listener. |
---|
Adds a push token listener.
listener | The listener. |
---|
Checks if notifications are enabled for the app and in the push manager.
true
if notifications are opted in, otherwise false
.
Gets the foreground notification display predicate.
Returns the send metadata of the last received push.
Returns the notification action group that is registered under the given name.
id | The id of the action group. |
---|
Returns the shared notification channel registry.
Gets the notification listener.
Gets the notification provider.
Returns the current Airship push notification status.
Gets the PushProviderType corresponding to the current push provider.
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Returns the Quiet Time interval currently set by the user.
Determines whether user-facing push notifications are enabled.
true
if user push is enabled, false
otherwise.
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Determines whether we are currently in the middle of "Quiet Time". Returns false if Quiet Time is disabled, and evaluates whether or not the current date/time falls within the Quiet Time interval set by the user.
Returns if the application is currently opted in for push.
true
if opted in for push.
Determines whether the app is capable of receiving push, meaning whether a FCM or ADM push token is present.
true
if push is available, false
otherwise.
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Determines whether "Quiet Time" is enabled.
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Determines whether sound is enabled.
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Determines whether vibration is enabled.
Removes the notification button group under the given name.
id | The id of the button group to remove. |
---|
Removes an Airship push notification status listener.
listener | The listener. |
---|
Removes a push listener.
listener | The listener. |
---|
Removes a push token listener.
listener | The listener. |
---|
Sets a predicate that determines if a notification should be presented in the foreground or not.
foregroundDisplayPredicate | The display predicate. |
---|
Sets the notification listener.
listener | The listener. |
---|
Sets the notification provider used to build notifications from a push message
If null
, notification will not be displayed.
provider | The notification provider |
---|
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Enables or disables quiet time.
enabled | A boolean indicating whether quiet time is enabled. |
---|
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Sets the Quiet Time interval.
startTime | A Date instance indicating when Quiet Time should start. |
---|---|
endTime | A Date instance indicating when Quiet Time should end. |
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Enables or disables sound.
enabled | A boolean indicating whether sound is enabled. |
---|
Enables or disables user notifications.
User notifications are push notifications that contain an alert message and are intended to be shown to the user.
This setting is persisted between application starts, so there is no need to call this repeatedly. It is only necessary to call this when a user preference has changed.
enabled | A boolean indicating whether user push is enabled. |
---|
This method is deprecated.
This setting does not work on Android O+. Applications are encouraged to
use NotificationChannelCompat
instead.
Enables or disables vibration.
enabled | A boolean indicating whether vibration is enabled. |
---|
Called when airship instance is ready.
airship | The airship instance. |
---|