cordova.call
Calls a function in a Cordova plugin and returns a result.
Syntax
ui.Interface.frontCall("cordova", "call",
[plugin-name, function-name [
, param1, param2, ... ]
],
[result]
)
- plugin-name - This is the name of the Cordova plugin.
- function-name - This is the name of plugin function to be called.
- param1, param2, ... - Optional parameters to be passed to the Cordova function.
- result - Holds the Cordova function return value.
Usage
The call
front call executes synchronously the Cordova plugin function
identified by the plugin-name and the function-name.
The other arguments (param1, param2, …) are arguments for
the Cordova plugin function. Each argument may have a different type like FLOAT
,
INTEGER
, STRING
, RECORD
or DYNAMIC
ARRAY
(for RECORD
and DYNAMIC ARRAY
, the runtime system
will do the BDL to JSON conversion automatically).
The front call returns one result variable of type FLOAT
,
INTEGER
, STRING
, RECORD
or DYNAMIC
ARRAY
, that matches the JSON equivalent of the plugin function result (for
RECORD
and DYNAMIC ARRAY
, the runtime system will do the JSON to
BDL conversion automatically).
The call
Cordova front call is synchronous: This means that the call will not
return until the plugin returns a result. Some functions may not return a result at all (such as
start/stop functions) and therefore would cause the front call to wait forever. Those functions need
to be called asynchroneously with the callWithoutWaiting
front call.
TRY/CATCH
or WHENEVER ERROR
.
Use the err_get()
function, to identify the reason of the error. For more
details about front call error handling, see ui.Interface.frontCall()
.
Example
DEFINE calendars DYNAMIC ARRAY OF STRING
CALL ui.interface.frontcall( "cordova", "call",
["Calendar", "listCalendars"], [calendars] )