getAttributes

Returns the maps of attributes set in the registration.

Syntax 

1MCReactModule.getAttributes()Promise.<Object.<string, string>>

Returns 

  • Promise.<Object.<string, string>> - A promise to the key-value map of attributes set in the registration.

Example 

1import { MCReactModule } from "react-native-marketingcloudsdk";
2
3const getDeviceAttributes = async () => {
4  try {
5    const attributes = await MCReactModule.getAttributes();
6    console.log("Device attributes:", attributes);
7    Object.entries(attributes).forEach(([key, value]) => {
8      console.log(`${key}: ${value}`);
9    });
10  } catch (error) {
11    console.error("Error getting attributes:", error);
12  }
13};

See Also 

Related Methods