Returns the maps of attributes set in the registration.
Syntax
MCReactModule.getAttributes() ⇒ Promise.<Object.<string, string>>
Returns
Promise.<Object.<string, string>>- A promise to the key-value map of attributes set in the registration.
Example
import { MCReactModule } from "react-native-marketingcloudsdk";
const getDeviceAttributes = async () => {
try {
const attributes = await MCReactModule.getAttributes();
console.log("Device attributes:", attributes);
Object.entries(attributes).forEach(([key, value]) => {
console.log(`${key}: ${value}`);
});
} catch (error) {
console.error("Error getting attributes:", error);
}
};
See Also
- setAttribute() Method
- clearAttribute() Method
- Android SDK Reference
- SDK Reference for iOS: attributes() Method