notifications.registerForPushNotifications()

Type Function
Return value none
Revision Release 2024.3703
Keywords notification, notifications, registerForPushNotifications
See also notifications.*

Overview

Register for push notifications on iOS. This will show the popup which asks the user if they want to enable push notifications. After the first call, subsequent calls will not show the popup again.

Gotchas

This function does nothing on Android.

Syntax

notifications.registerForPushNotifications( [params] )
params (optional)

Table. Optional table containing registration parameters — see the next section for details.

Parameter Reference

The params table includes additional parameters for notification registration.

useFCM (optional)

Boolean. If you're using Google Firebase Cloud Messaging (FCM), include this key with a value of true.

Examples

Default
local notifications = require( "plugin.notifications.v2" )

notifications.registerForPushNotifications()
Firebase (FCM)
local notifications = require( "plugin.notifications.v2" )

notifications.registerForPushNotifications( { useFCM=true } )