Anyone ever encounter error such as "WL should be created first"?
My android device and emulator throw error callback when they connect to MFP server or call adapter.
However, my browser simulator works perfectly when they call adapter. MFP Server version 8.0.0.00-20160803-0909 MFP CLI version 8.0.0-2016070716 Cordova version 6.3.0
This is one of the part that gives me "WL should be created first"
function wlCommonInit() {
WL.App.getServerUrl(function (url) {
alert(url);
});
MFPPush.initialize(
function(success){
//alert('--> push init success');
MFPPush.registerNotificationsCallback(NotificationReceived);
},
function(failure){
//alert('--> push init failure', failure);
}
)
var NotificationReceived = function(message) {
console.log('--> push notification received', message)
//alert(message.alert);
}
WLAuthorizationManager.obtainAccessToken("push.mobileclient")
.then(
function (accessToken) {
alert("Connected to MobileFirst Server");
var options = {"phoneNumber": ""};
MFPPush.registerDevice(
options,
function(success){
//alert('--> push register success');
var tag = ['permataMobile'];
MFPPush.subscribe(
tag,
function(success){
//alert('--> push subscribe success');
},
function(failure){
//alert('--> push subscribe failure', failure);
}
)
},
function(failure){
//alert('--> push register failure '+ JSON.stringify(failure));
}
)
},
function (error) {
//alert("Failed to connect to MobileFirst Server");
}
);
}