public class

AirshipChannel

extends AirshipComponent
java.lang.Object
   ↳ com.urbanairship.AirshipComponent
     ↳ com.urbanairship.channel.AirshipChannel

Class Overview

Airship channel access.

Summary

Constants
String ACTION_CHANNEL_CREATED Broadcast that is sent when a channel has been created.
Public Methods
void addChannelListener(AirshipChannelListener listener)
Adds a channel listener.
AttributeEditor editAttributes()
Edit the attributes associated with this channel.
SubscriptionListEditor editSubscriptionLists()
Edit the channel subscription lists.
TagGroupsEditor editTagGroups()
Edit the channel tag groups.
TagEditor editTags()
Edits channel Tags.
void enableChannelCreation()
Enables channel creation if channel creation has been delayed.
boolean getChannelTagRegistrationEnabled()
Determines whether tags are enabled on the device.
String getId()
Gets the channel identifier.
PendingResult<Set<String>> getSubscriptionLists(boolean includePendingUpdates)
Returns the current set of subscription lists for this channel, optionally applying pending subscription list changes that will be applied during the next channel update.
Set<String> getTags()
Returns the current set of tags.
void removeChannelListener(AirshipChannelListener listener)
Removes a channel listener.
void setChannelTagRegistrationEnabled(boolean enabled)
Sets whether tags are enabled on the device.
void setTags(Set<String> tags)
Set tags for the channel and update the server.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_CHANNEL_CREATED

Broadcast that is sent when a channel has been created.

Constant Value: "com.urbanairship.CHANNEL_CREATED"

Public Methods

public void addChannelListener (AirshipChannelListener listener)

Adds a channel listener.

Parameters
listener The listener.

public AttributeEditor editAttributes ()

Edit the attributes associated with this channel.

Returns

public SubscriptionListEditor editSubscriptionLists ()

Edit the channel subscription lists.

public TagGroupsEditor editTagGroups ()

Edit the channel tag groups.

Returns

public TagEditor editTags ()

Edits channel Tags.

Returns

public void enableChannelCreation ()

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 to true in the airship config.

public boolean getChannelTagRegistrationEnabled ()

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.

Returns
  • true if tags are enabled on the device, false otherwise.

public String getId ()

Gets the channel identifier. This Id is created asynchronously, so initially it may be null. To be notified when the channel is updated, add a listener with addChannelListener(AirshipChannelListener).

Returns
  • The channel Id, or null if the Id is not yet created.

public PendingResult<Set<String>> getSubscriptionLists (boolean includePendingUpdates)

Returns the current set of subscription lists for this channel, optionally applying pending subscription list changes that will be applied during the next channel update.

An empty set indicates that this channel is not subscribed to any lists.

Parameters
includePendingUpdates `true` to apply pending updates to the returned set, `false` to return the set without pending updates.
Returns

public Set<String> getTags ()

Returns the current set of tags.

An empty set indicates that no tags are set on this channel.

Returns
  • The current set of tags.

public void removeChannelListener (AirshipChannelListener listener)

Removes a channel listener.

Parameters
listener The listener.

public void setChannelTagRegistrationEnabled (boolean enabled)

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.

Parameters
enabled A boolean indicating whether tags are enabled on the device.

public void setTags (Set<String> tags)

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.

Parameters
tags A set of tag strings.