I created a new method to call from cordova based on android sdk:
//Android Sdk
HuggyChat huggyChat = HuggyChat.getInstance(this.SDK_ID, YourChatActivity.this).setUpWebView(yourWebView);
// Send message to chat
huggyChat.callApiMethod("sendMessage", "Minha primeira mensagem");
//New Method for cordova
public void callApiMethod(String methodName, String data, CallbackContext callbackContext) {
try {
HuggyChat.getInstance().callApiMethod(methodName, data);
callbackContext.success();
} catch (Exception e) {
callbackContext.error(e.getMessage());
}
}
It's called after chat opened.
But doesnt work. The callApiMethod is receiving the data normally and the instance exists in debug, but it doesn't execute the method.
Example:
window.cordova.plugins.huggychat.openHuggyChat(
"SKD-KEY",
"Huggy Chat",
(success) => {
console.log('openHuggyChatSuccess', success); //It's logging
setTimeout(() => {
window.cordova.plugins.huggychat.callApiMethod('sendMessage', 'Minha primeira mensagem',
(success) => {
console.log('callApiMethodSuccess', success); //It's Logging
},
(error) => { console.error('callApiMethodError', error); }
)
}, 10000)},
(error) => { console.error('openHuggyChatError', error); }
);
I created a new method to call from cordova based on android sdk:
It's called after chat opened.
But doesnt work. The callApiMethod is receiving the data normally and the instance exists in debug, but it doesn't execute the method.
Example: