java.lang.Object | ||
↳ | com.urbanairship.BaseManager | |
↳ | com.urbanairship.push.PushManager |
This class is the primary interface for customizing the display and behavior of incoming push notifications.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_CHANNEL_UPDATED | Action sent as a broadcast when a channel registration succeeds. | |||||||||
String | ACTION_NOTIFICATION_DISMISSED | Action sent as a broadcast when a notification is dismissed. | |||||||||
String | ACTION_NOTIFICATION_OPENED | Action sent as a broadcast when a notification is opened. | |||||||||
String | ACTION_PUSH_RECEIVED | Action sent as a broadcast when a push message is received. | |||||||||
String | EXTRA_CHANNEL_ID | The channel ID extra. | |||||||||
String | EXTRA_ERROR | Extra used to indicate an error in channel registration. | |||||||||
String | EXTRA_NOTIFICATION_BUTTON_FOREGROUND | The flag indicating if the interactive notification action button is background or foreground. | |||||||||
String | EXTRA_NOTIFICATION_BUTTON_ID | The interactive notification action button identifier extra. | |||||||||
String | EXTRA_NOTIFICATION_ID | The notification ID extra contains the ID of the notification placed in the
NotificationManager by the library. |
|||||||||
String | EXTRA_PUSH_MESSAGE | The push message extra. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addNotificationActionButtonGroup(String id, NotificationActionButtonGroup group)
Register a notification action group under the given name.
| ||||||||||
TagGroupsEditor |
editTagGroups()
Edit the channel tag groups.
| ||||||||||
void |
enableChannelCreation()
Enables channel creation if channel creation has been delayed.
| ||||||||||
String |
getAdmId()
Returns the currently registered ADM ID.
| ||||||||||
String |
getAlias()
Returns the current alias for this application's channel.
| ||||||||||
String |
getChannelId()
Get the Channel ID
| ||||||||||
boolean |
getChannelTagRegistrationEnabled()
Determines whether tags are enabled on the device.
| ||||||||||
boolean |
getDeviceTagsEnabled()
This method is deprecated.
Marked to be removed in 7.0.0. Use
getChannelTagRegistrationEnabled() instead.
| ||||||||||
String |
getGcmId()
This method is deprecated.
Marked to be removed in 7.0.0. The GCM security token for
gcmSender
is available with getGcmToken() .
| ||||||||||
String |
getGcmToken()
Gets the GCM Instance ID token.
| ||||||||||
String |
getLastReceivedSendId()
Returns the send id of the last received push.
| ||||||||||
NamedUser |
getNamedUser()
Returns the current named user.
| ||||||||||
NotificationActionButtonGroup |
getNotificationActionGroup(String id)
Returns the notification action group that is registered under the given name.
| ||||||||||
NotificationFactory |
getNotificationFactory()
Returns the current notification factory.
| ||||||||||
boolean |
getPushTokenRegistrationEnabled()
Determines whether the GCM token or ADM ID is sent during channel registration.
| ||||||||||
Date[] |
getQuietTimeInterval()
Returns the Quiet Time interval currently set by the user.
| ||||||||||
Set<String> |
getTags()
Returns the current set of tags.
| ||||||||||
boolean |
getUserNotificationsEnabled()
Determines whether user-facing push notifications are enabled.
| ||||||||||
boolean |
isInQuietTime()
Determines whether we are currently in the middle of "Quiet Time".
| ||||||||||
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 GCM or ADM registration ID is present.
| ||||||||||
boolean |
isPushEnabled()
Determines whether push is enabled.
| ||||||||||
boolean |
isQuietTimeEnabled()
Determines whether "Quiet Time" is enabled.
| ||||||||||
boolean |
isSoundEnabled()
Determines whether sound is enabled.
| ||||||||||
boolean |
isVibrateEnabled()
Determines whether vibration is enabled.
| ||||||||||
void |
removeNotificationActionButtonGroup(String id)
Removes the notification button group under the given name.
| ||||||||||
void |
setAlias(String alias)
Set the alias for the channel and update the server.
| ||||||||||
void |
setAliasAndTags(String alias, Set<String> tags)
Sets both the alias and tags for this channel and updates the server.
| ||||||||||
void |
setChannelTagRegistrationEnabled(boolean enabled)
Sets whether tags are enabled on the device.
| ||||||||||
void |
setDeviceTagsEnabled(boolean enabled)
This method is deprecated.
Marked to be removed in 7.0.0. Use
setChannelTagRegistrationEnabled(boolean) instead.
| ||||||||||
void |
setNotificationFactory(NotificationFactory factory)
Sets the notification factory used when push notifications are received.
| ||||||||||
void |
setPushEnabled(boolean enabled)
Enables or disables push notifications.
| ||||||||||
void |
setPushTokenRegistrationEnabled(boolean enabled)
Sets whether the GCM token or ADM ID is sent during channel registration.
| ||||||||||
void |
setQuietTimeEnabled(boolean enabled)
Sets the quiet time enabled.
| ||||||||||
void |
setQuietTimeInterval(Date startTime, Date endTime)
Sets the Quiet Time interval.
| ||||||||||
void |
setSoundEnabled(boolean enabled)
Enables or disables sound.
| ||||||||||
void |
setTags(Set<String> tags)
Set tags for the channel and update the server.
| ||||||||||
void |
setUserNotificationsEnabled(boolean enabled)
Enables or disables user notifications.
| ||||||||||
void |
setVibrateEnabled(boolean enabled)
Enables or disables vibration.
| ||||||||||
void |
updateRegistration()
Update registration.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
init()
Initialize the manager.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Action sent as a broadcast when a channel registration succeeds.
Extras:EXTRA_CHANNEL_ID
Action sent as a broadcast when a notification is dismissed.
Extras:EXTRA_NOTIFICATION_ID
,
EXTRA_PUSH_MESSAGE
Action sent as a broadcast when a notification is opened.
Extras:EXTRA_NOTIFICATION_ID
,
EXTRA_PUSH_MESSAGE
,
EXTRA_NOTIFICATION_BUTTON_ID
,
EXTRA_NOTIFICATION_BUTTON_FOREGROUND
Action sent as a broadcast when a push message is received.
Extras:EXTRA_NOTIFICATION_ID
,
EXTRA_PUSH_MESSAGE
The channel ID extra.
Extra used to indicate an error in channel registration.
The flag indicating if the interactive notification action button is background or foreground.
The interactive notification action button identifier extra.
The notification ID extra contains the ID of the notification placed in the
NotificationManager
by the library.
Notification
was not created, the extra will not be included.
The push message extra.
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 theEXTRA_INTERACTIVE_TYPE
key.id | The id of the action group. |
---|---|
group | The notification action group. |
Enables channel creation if channel creation has been delayed.
This setting is persisted between application starts, so there is no need to call this repeatedly. It is only necessary to call this when channelCreationDelayEnabled has been set totrue
in the airship config.
Returns the currently registered ADM ID.
Returns the current alias for this application's channel.
Determines whether tags are enabled on the device.
If false
, no locally specified tags will be sent to the server during registration.
The default value is true
.
true
if tags are enabled on the device, false
otherwise.
This method is deprecated.
Marked to be removed in 7.0.0. Use getChannelTagRegistrationEnabled()
instead.
Determines whether tags are enabled on the device.
If false
, no locally specified tags will be sent to the server during registration.
The default value is true
.
true
if tags are enabled on the device, false
otherwise.
This method is deprecated.
Marked to be removed in 7.0.0. The GCM security token for gcmSender
is available with getGcmToken()
.
Returns the currently registered GCM ID.
Returns the send id 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 current notification factory.
Determines whether the GCM token or ADM ID is sent during channel registration.
If false
, the app will not be able to receive push notifications.
The default value is true
.
true
if the GCM token or ADM ID is sent during channel registration,
false
otherwise.
Returns the Quiet Time interval currently set by the user.
Returns the current set of tags.
An empty set indicates that no tags are set on this channel.Determines whether user-facing push notifications are enabled.
true
if user push is enabled, false
otherwise.
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 GCM or ADM registration ID is present.
true
if push is available, false
otherwise.
Determines whether push is enabled.
true
if push is enabled, false
otherwise.
This defaults to false, and must be explicitly set by the app.
Determines whether "Quiet Time" is enabled.
Determines whether sound is enabled.
Determines whether vibration is enabled.
Removes the notification button group under the given name.
id | The id of the button group to remove. |
---|
Set the alias for the channel and update the server.
If you are setting both the alias and tags at the same time, you should usesetAliasAndTags(String, Set)
to avoid making an extra
network call.
Refer to the
Alias
for more information on the use of aliases.alias | The alias, null to remove
|
---|
Sets both the alias and tags for this channel and updates the server.
Tags should be URL-safe with a length greater than 0 and less than 127 characters. If your tag includes whitespace or special characters, we recommend URL encoding the string.alias | The desired alias, null to remove |
---|---|
tags | The desired set of tags, must be non-null |
Sets whether tags are enabled on the device. The default value is true
.
If false
, no locally specified tags will be sent to the server during registration.
enabled | A boolean indicating whether tags are enabled on the device. |
---|
This method is deprecated.
Marked to be removed in 7.0.0. Use setChannelTagRegistrationEnabled(boolean)
instead.
Sets whether tags are enabled on the device. The default value is true
.
If false
, no locally specified tags will be sent to the server during registration.
enabled | A boolean indicating whether tags are enabled on the device. |
---|
Sets the notification factory used when push notifications are received.
Specify a notification factory here to customize the display of a push notification's Custom Expanded Views in the Android Notification Manager. Ifnull
, push notifications will not be displayed by the
library.factory | The notification factory |
---|
Enables or disables push notifications.
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 push is enabled. |
---|
Sets whether the GCM token or ADM ID is sent during channel registration.
If false
, the app will not be able to receive push notifications.
enabled | A boolean indicating whether the GCM token or ADM ID is sent during channel registration. |
---|
Sets the quiet time enabled.
enabled | A boolean indicating whether quiet time is enabled. |
---|
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. |
Enables or disables sound.
enabled | A boolean indicating whether sound is enabled. |
---|
Set tags for the channel and update the server.
Tags should be URL-safe with a length greater than 0 and less than 127 characters. If your tag includes whitespace or special characters, we recommend URL encoding the string. To clear the current set of tags, pass an empty set to this method. If you are setting both the alias and tags at the same time, you should usesetAliasAndTags(String, Set)
to avoid making an extra
network call.
Refer to the Tag API for
more information.tags | A set of tag strings. |
---|
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. |
---|
Enables or disables vibration.
enabled | A boolean indicating whether vibration is enabled. |
---|
Update registration.