I've implemented MC Cordova Plugin (https://github.com/salesforce-marketingcloud/MC-Cordova-Plugin) for push notification through Marketing Cloud for hybrid mobile app, but encountering problems to clear and set Attribute.
The first time I install the app, clearAttribute and setAttribute will work perfectly. But after update the data and triggering clearAttribute and setAttribute the next time, values are not updated.
For example, in this scenario I want to update attribute everytime I log in to a new user :
log out -> call clear Attribute logged in -> set Contact Key and set Attribute
the first user data is updated using contact key and set attribute (e.g. value : "abc"), the first time I logged out, the value is cleared too. (e.g. value : "")
However, after 2nd and more attempt, the value from variable in attribute will not updated by using set attribute(e.g. new value should be "def", but in attribute still value : "abc"), and not cleared using clear Attribute after log out (e.g. still -> value : "abc").
FYI the return is SUCCESSFUL from the plugin (for Android the return is "OK")
I've used Java 1.8, Cordova 7.0.0, Android Cordova v.6.3.0
MC Cordova Plugin version : 2.0.0 com.salesforce.marketingcloud.cordovaplugin
Snippet Code :
document.addEventListener("deviceready",()=>{
MCCordovaPlugin.setContactKey((success) =>{
console.log("success set contact key");
console.log(success);
}, (error) => {
console.log("error set contact key");
console.log(error);
}, this.contactKey);
MCCordovaPlugin.getContactKey((success) =>{
console.log("success GET contact key");
console.log(success);
}, (error) => {
console.log("error GET contact key");
console.log(error);
});
MCCordovaPlugin.setAttribute((success) =>{
console.log("success set attribute ID");
console.log(success);
}, (error) => {
console.log("error set attribute ID");
console.log(error);
}, "NewID", this.contactKey);
}, false);
Kindly need your help about this behavior, thanks a lot!
Regards,