Subscription Lists for the Android SDK

Manage channel and contact subscription lists for topic-based messaging.

For information about Subscription Lists, including overview, use cases, and how to create subscription lists, see Subscription Lists.

Channel Subscription Lists

Channel subscriptions apply only to the single channel.

Channel subscription lists

// Modifying channel subscription lists
Airship.channel.editSubscriptionLists {
    subscribe("food")
    unsubscribe("sports")
}

// Fetching channel subscription lists
val channelSubscriptions = Airship.channel.fetchSubscriptionLists()
// Modifying channel subscription lists
Airship.getChannel().editSubscriptionLists()
    .subscribe("food")
    .unsubscribe("sports")
    .apply();

// Fetching channel subscription lists
PendingResult<Set<String>> channelSubscriptions =
    Airship.getChannel().fetchSubscriptionListsPendingResult();

Contact Subscription Lists

Contact subscriptions are set at the user level and require a Channel scope that specifies the types to which the subscription list applies.

Contact subscription lists

// Modifying contact subscription lists
Airship.contact.editSubscriptionLists {
    subscribe("food", "app")
    unsubscribe("sports", "sms")
}

// Fetching contact subscription lists
val contactSubscriptions = Airship.contact.fetchSubscriptionLists()
// Modifying contact subscription lists
Airship.getContact().editSubscriptionLists()
    .subscribe("food", "app")
    .unsubscribe("sports", "sms")
    .apply();

// Fetching contact subscription lists
PendingResult<Map<String, Set<Scope>>> contactSubscriptions =
    Airship.getContact().fetchSubscriptionListsPendingResult();

Verifying Subscription Lists

To verify that subscription lists are set correctly, look up the channel or contact in the Contact Management view. Search by Channel ID or Named User ID to view the subscription lists associated with a channel or contact.