Push Notifications

Enabling User Notifications

The Airship SDK makes a distinction between "user notifications," which can be seen by the user, and other forms of push that allow you to send data to your app silently, or in the background. Enabling or disabling user notifications is a preference often best left up to the user, so by default, user notifications are disabled.

Enable user notifications
UAirship.Shared.UserNotificationsEnabled = true;

Foreground Presentation Options

The SDK provides support for foreground presentation options that were introduced in iOS 10. The three UNNotificationPresentationOptions constants are badge, sound, and alert. These constants specify how to present a notification when the application receives a remote notification in the foreground. You can set default presentation options that will be applied to all remote-notifications.

Listening for Events

Available events

OnChannelUpdated
Event when channel registration updates.
OnChannelUpdated
UAirship.Shared.OnChannelUpdated += (string channelId) => {
  Debug.Log ("Channel updated: " + channelId);
};
OnDeepLinkReceived
Event when a new deep link is available. The app should navigate to the proper page when the event is received.
OnDeepLinkReceived
UAirship.Shared.OnDeepLinkReceived += (string deeplink) => {
  Debug.Log ("Received deep link: " + deeplink);
};
OnPushReceived
Event when a push is received.
OnPushReceived
UAirship.Shared.OnPushReceived += (PushMessage message) => {
  Debug.Log ("Received push! " + message.Alert);
};