Push notifications

The purpose of the push notification integration is to make it possible to send push notifications to the users of the app.

Introduction

The push notification integration makes it possible for you to send push notifications to the users of the app using the Firebase Cloud Messaging service.

To get started we suggest you read the FAQ about push notifications.

Integration name: PushNotificationIntegration

Methods

initialize

initialize(): bool

This method should be called when the user want’s to receive push notifications. When calling this method the result is a bit different on the two platforms. On iOS the user will be asked if it’s okay to receive push notifications. On Android nothing happens in the user interface. The method returns true when the call has been completed.

getLastPublishedToken

getLastPublishedToken(): string

This method returns the token which should be used to send push notifications.

Events

tokenReceivedEvent

tokenReceivedEvent(token: string)

Called with the token used to send push notifications to the current device.

notificationReceivedEvent

notificationReceivedEvent(notification: any)

Called with the notification that has been received by the mobile. The content of notification is the content that has been sent from the backend. There will also be a special property called appWasLaunchedFromNotification which indicated wether the app entered the foreground because a notification as pressed on the device or wether the app already was in the foreground when the notification was received.