register

fun register(context: Context, instance: String = INSTANCE_DEFAULT, messageForDistributor: String? = null, vapid: String? = null)

Request a new registration for the instance to the saved distributor.

saveDistributor must be called before this function.

If there was a distributor but it has been removed, MessagingReceiver.onUnregistered will be called for all subscribed instances.

Parameters

context

To interact with the shared preferences and send broadcast intents.

instance

Registration instance. Can be used to get multiple registrations, eg. for multi-account support.

messageForDistributor

May be shown by the distributor UI to identify this registration.

vapid

VAPID public key (RFC8292) base64url encoded of the uncompressed form (87 chars long).

Throws

if vapid is not in the in the uncompressed form and base64url encoded.


fun register(context: Context, instance: String = INSTANCE_DEFAULT, messageForDistributor: String? = null, vapid: String? = null, keyManager: KeyManager)

register with additional KeyManager parameter.

Parameters

keyManager

To manager web push keys. By default: DefaultKeyManager.