Named Users allow you to associate multiple devices to a single user or profile that may be associated with more than one device, e.g., an end-user’s tablet and phone. A device can have only one Named User, and a single Named User should not be associated with more than 50 devices. Named Users provide the ability to directly set tags on them.
By default, Named Users can only be associated server-side. A 403 Forbidden response is returned if Named User association is attempted when client-side association is disabled. In order to associate a Named User through the application, you must change the application’s Named User security setting to allow Named Users to be set from devices. To enable this option, go to Settings » APIs & Integrations » Named Users.
Associating the channel with a Named User ID will implicitly disassociate the channel from the previously associated Named User ID, if an association existed.
UAirship.Shared.NamedUserId = "coolNamedUserId";
UAirship.Shared.NamedUserId = null;
Attributes are key-value pairs that you associate with your audience to help better target them with messages. Use attributes to target audiences with greater specificity than you would with tags. For more information see the attributes guide.
UAirship.Shared.EditChannelAttributes() .SettAttribute("device_name", "Bobby's Phone") .SetAttribute("average_rating", 4.99) .RemoveAttribute("connection_type") .Apply()
Tags allow you to attribute arbitrary metadata to a specific device. Common examples include favorites such as sports teams or news story categories.
// Add tag UAirship.Shared.AddTag ("some-tag"); // Remove tag UAirship.Shared.RemoveTag ("other-tag");
// Get tags IEnumerable<string> tags = UAirship.Shared.Tags;
Tag groups are configurable namespaces for organizing tags for the channel and Named User. Please view the Tag Groups documentation for more details. The Create and push to a tag group guides you through creating and using Tag Groups.
UAirship.Shared.EditChannelTagGroups () .AddTag ("loyalty", "silver-member") .RemoveTag ("loyalty", "bronze-member") .Apply ();
UAirship.Shared.EditNamedUserTagGroups () .AddTag ("loyalty", "silver-member") .RemoveTag ("loyalty", "bronze-member") .Apply ();
By default, Tag Groups cannot be modified from the device. In this case if a device attempts to modify Tag Groups, the modification will fail and the SDK will log an error. In order to change this setting, follow the steps in Manage Tag Groups.
Airship Channel IDs
The Channel ID is a unique identifier that ties together an application/device pair on a mobile device. The Channel ID is used to target pushes to specific devices using the Airship API. Once a Channel ID is created, it will persist in the application. It may or may not change when the application is reinstalled. For more information on platform-specific operation, see the Android and iOS documentation.
Don’t worry if this value initially comes back as null on your app’s first run (or after clearing the application data), as the Channel ID will be created and persisted during registration. To receive an event when the Channel ID is created, see Listening for Events.
string channelId = UAirship.Shared.ChannelId;