public class

NotificationChannelCompat

extends Object
implements JsonSerializable
java.lang.Object
   ↳ com.urbanairship.push.notifications.NotificationChannelCompat

Class Overview

Compatibility class for supporting NotificationChannel functionality across Android OS versions.

Summary

Public Constructors
NotificationChannelCompat(NotificationChannel notificationChannel)
NotificationChannelCompat constructor.
NotificationChannelCompat(String id, CharSequence name, int importance)
NotificationChannelCompat constructor.
Public Methods
void enableLights(boolean lights)
Sets whether the channel can show lights.
void enableVibration(boolean vibration)
Sets whether the channel can vibrate.
boolean equals(Object o)
static NotificationChannelCompat fromJson(JsonValue jsonValue)
Factory method for creating a NotificationChannelCompat out of a JSON payload.
boolean getBypassDnd()
Indicates whether the channel can bypass do-not-disturb.
String getDescription()
Gets the channel's description.
String getGroup()
Gets the channel's group.
String getId()
Gets the channel's identifier.
int getImportance()
Gets the channel's importance.
int getLightColor()
Gets the channel's light color.
int getLockscreenVisibility()
Gets the channel's lockscreen visibility.
CharSequence getName()
Gets the channel's name.
boolean getShowBadge()
Indicates whether the channel can show badges
Uri getSound()
Gets the channel's sound.
long[] getVibrationPattern()
Gets the channel's vibration pattern.
int hashCode()
void setBypassDnd(boolean bypassDnd)
Sets whether the channel can bypass do-not-disturb.
void setDescription(String description)
Sets the channel's description.
void setGroup(String group)
Sets the channel's group.
void setImportance(int importance)
Sets the channel's importance.
void setLightColor(int argb)
Sets the channel's light color.
void setLockscreenVisibility(int lockscreenVisibility)
Sets the channel's lockscreen visibility.
void setName(CharSequence name)
Sets the channel's name.
void setShowBadge(boolean showBadge)
Sets whether the channel can show badges.
void setSound(Uri sound)
Sets the channel's sound.
void setVibrationPattern(long[] vibrationPattern)
Sets the channel's vibration pattern.
boolean shouldShowLights()
Indicates whether the channel can show lights.
boolean shouldVibrate()
Indicates whether the channel can vibrate.
JsonValue toJsonValue()
Returns the objects represented as a JsonValue.
NotificationChannel toNotificationChannel()
Creates a corresponding NotificationChannel object for Android O and above.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.json.JsonSerializable

Public Constructors

public NotificationChannelCompat (NotificationChannel notificationChannel)

NotificationChannelCompat constructor.

Parameters
notificationChannel A NotificationChannel instance.

public NotificationChannelCompat (String id, CharSequence name, int importance)

NotificationChannelCompat constructor.

Parameters
id The channel identifier.
name The channel name.
importance The notification importance.

Public Methods

public void enableLights (boolean lights)

Sets whether the channel can show lights.

Parameters
lights Whether the channel can show lights.

public void enableVibration (boolean vibration)

Sets whether the channel can vibrate.

Parameters
vibration Whether the channel can vibrate.

public boolean equals (Object o)

public static NotificationChannelCompat fromJson (JsonValue jsonValue)

Factory method for creating a NotificationChannelCompat out of a JSON payload.

Parameters
jsonValue The JSON payload.
Returns
  • A NotificationChannelCompat instance, or null if one could not be deserialized.

public boolean getBypassDnd ()

Indicates whether the channel can bypass do-not-disturb.

Returns
  • true if the channel can bypass do-not-distrub, false otherwise.

public String getDescription ()

Gets the channel's description.

Returns
  • The description.

public String getGroup ()

Gets the channel's group.

Returns
  • The group.

public String getId ()

Gets the channel's identifier.

Returns
  • The identifier.

public int getImportance ()

Gets the channel's importance.

Returns
  • The importance.

public int getLightColor ()

Gets the channel's light color.

Returns
  • The light color.

public int getLockscreenVisibility ()

Gets the channel's lockscreen visibility.

Returns
  • The lockscreen visibility.

public CharSequence getName ()

Gets the channel's name.

Returns
  • The name.

public boolean getShowBadge ()

Indicates whether the channel can show badges

Returns
  • true if the channel can show badges, false otherwise.

public Uri getSound ()

Gets the channel's sound.

Returns
  • The sound.

public long[] getVibrationPattern ()

Gets the channel's vibration pattern.

Returns
  • The vibration pattern.

public int hashCode ()

public void setBypassDnd (boolean bypassDnd)

Sets whether the channel can bypass do-not-disturb.

Parameters
bypassDnd Whether the channel can bypass do-not-disturb.

public void setDescription (String description)

Sets the channel's description.

Parameters
description The description.

public void setGroup (String group)

Sets the channel's group.

Parameters
group The group.

public void setImportance (int importance)

Sets the channel's importance.

Parameters
importance The importance.

public void setLightColor (int argb)

Sets the channel's light color.

Parameters
argb The light color.

public void setLockscreenVisibility (int lockscreenVisibility)

Sets the channel's lockscreen visibility.

Parameters
lockscreenVisibility The lockscreen visibility.

public void setName (CharSequence name)

Sets the channel's name.

Parameters
name The name.

public void setShowBadge (boolean showBadge)

Sets whether the channel can show badges.

Parameters
showBadge Whether the channel can show badges.

public void setSound (Uri sound)

Sets the channel's sound.

Parameters
sound The sound.

public void setVibrationPattern (long[] vibrationPattern)

Sets the channel's vibration pattern.

Parameters
vibrationPattern The vibration pattern.

public boolean shouldShowLights ()

Indicates whether the channel can show lights.

Returns
  • true if the channel can show lights, false otherwise.

public boolean shouldVibrate ()

Indicates whether the channel can vibrate.

Returns
  • true if the channel can vibrate, false otherwise.

public JsonValue toJsonValue ()

Returns the objects represented as a JsonValue.

Returns
  • The object as a JsonValue.

public NotificationChannel toNotificationChannel ()

Creates a corresponding NotificationChannel object for Android O and above.

Returns
  • A NotificationChannel.

public String toString ()