Closed vokecodes closed 2 years ago
I added this line of code to the initialization defaultMessageStorage: true
. I didn't get the error but messages didn't get deleted.
Hi @vokecodes, I suppose plugin version you are using is 5.0.1? Could you may be share logs and which platform are you testing?
@riskpp Yes, 5.0.1. Testing on Android. Shared logs via mail.
Hi @vokecodes, from my side everything looks fine. You can check may be you've missed something from the Default message storage doc.
I've just implemented following in Example app
Don't forget to add defaultMessageStorage: true
to the config.
//components/homeScreen.js
//Implemented methods for default storage
class HomeScreen extends React.Component {
...
deleteAll() {
mobileMessaging.defaultMessageStorage().deleteAll(() => {
console.log('Delete all');
});
}
findAll() {
mobileMessaging.defaultMessageStorage().findAll((messages) => {
console.log('Find All, Messages: ' + JSON.stringify(messages));
});
}
}
...
//Added buttons to the home screen
render() {
return (
<View style={styles.infoView}>
...
<Button
title="Delete All on default storage"
onPress={() => this.deleteAll()}
/>
<Button
title="Find all messages from default storage"
onPress={() => this.findAll()}
/>
</View>
);
}
Resulting logs:
LOG Event: ["messageReceived",{"body":"Text1","title":"Title1"}]
LOG Event: ["messageReceived",{"body":"Text2", "title":"Title2"}]
LOG Find All, Messages: [{"body":"Text1","title":"Title1"},{"body":"Text2","title":"Title2"}]
LOG Delete all
LOG Find All, Messages: []
Hi @riskpp , thanks. I made use of the Personalize API and that works well.
When I use mobileMessaging.personalize({userIdentity})
, returns below error
Invalid phone number: 27999999913 (number does not have valid country/network prefix)
This is the user object passed
const userIdentity = {
firstName: customer.firstName,
lastName: customer.lastName,
phones: [`+${customer.phone1}`],
emails: [customer.email],
externalUserId: customer.externalUniqueId,
};
Check the format of the number it should correspond to https://en.wikipedia.org/wiki/E.164, more information also here
Yes, I formatted it
Invalid phone number: 270999999913 (number does not have valid country/network prefix)
Hi @vokecodes, could you check the number one more time, it doesn't look valid per these rules - https://en.wikipedia.org/wiki/E.164
I used a random test number but need to use a real phone number.
Below code results in a promise rejection with the error
TypeError: Cannot read property 'deleteAll' of undefined