Messaging

interface Messaging

Messaging feature — interact with Firebase Cloud Messaging (FCM) through AFCore.

This interface provides operations for:

  • Managing device tokens (register, update, delete).

  • Requesting notification permissions.

  • Subscribing/unsubscribing to topics.

  • Receiving foreground data messages.

  • Configuring notification presentation options.

Platform & threading

  • All suspend functions must be called from a coroutine.

  • Errors surface as Throwable and should be handled at call sites.

Typical flows

Properties

Link copied to clipboard
abstract val messages: Flow<IncomingMessage>

Stream of foreground data messages.

Functions

Link copied to clipboard
abstract suspend fun deleteToken(deviceId: String): Boolean

Deletes the device’s FCM token on the backend.

Link copied to clipboard
abstract suspend fun getToken(): String?

Retrieves the current FCM token from the server.

Link copied to clipboard

Configures system notification presentation.

Link copied to clipboard
abstract suspend fun subscribe(topic: String): Boolean

Subscribes the current device to an FCM topic.

Link copied to clipboard
abstract suspend fun unsubscribe(topic: String): Boolean

Unsubscribes the current device from an FCM topic.

Link copied to clipboard
abstract suspend fun updateToken(deviceId: String): Boolean

Updates the device’s FCM token on the backend.