Structure changes and bug fix
Several changes in the Cordova SDK to make the use of the SDK easier:
- Changed signature of the initialization method. Now you should pass keys and other parameters wrapped in a JSON object
ApiAIPlugin.init(
{
subscriptionKey: 'subscriptionKey',
clientAccessToken: 'clientAccessToken',
lang: 'en'
},
function () {
alert("Init success");
},
function (error) {
alert("Init error\n" + error);
});
- You don't need to pass language code in the request method. Language settings are picked up from the SDK configuration defined in the
ApiAIPlugin.init()
method.
function sendVoice() {
try {
ApiAIPlugin.requestVoice(
{}, // empty for simple requests, some optional parameters can be here
function (response) {
// place your result processing here
alert(JSON.stringify(response));
},
function (error) {
// place your error processing here
alert(error);
});
} catch (e) {
alert(e);
}
}
- Fixed bugs with wrong output format on Android platform and issues with initialization callbacks not being called.