getSystemToken

This method returns the token used by Marketing Cloud Engagement to send push messages to the device.

Syntax 

1MCReactModule.getSystemToken()Promise.<string?>

Returns 

  • Promise.<string?> - A promise to the system token string.

Example 

1import { MCReactModule } from "react-native-marketingcloudsdk";
2
3const getToken = async () => {
4  try {
5    const token = await MCReactModule.getSystemToken();
6    if (token) {
7      console.log("System token:", token);
8    } else {
9      console.log("No system token available");
10    }
11  } catch (error) {
12    console.error("Error getting system token:", error);
13  }
14};

See Also