Skip to main content

How to get FCM token

Overview​

This tutorial shows you how to get the FCM token from the appmaker app. You can use this token to send push notifications to your users.

Methods​

FCM token is a unique token that is generated for each device.

import { onEvent } from '@appmaker-xyz/core';
onEvent('on_fcm_token', async (fcmToken) => {
console.log("on_fcm_token", fcmToken);

});
onEvent('on_fcm_token_change', async (fcmToken) => {
console.log("on_fcm_token", fcmToken);

});

Any of the above events will be triggered when the FCM token is generated or changed. You can use this token to send push notifications to your users.