cordova.getCallbackData
Returns the first Cordova plugin result from the result queue of all asynchronous Cordova plugin front calls, and removes it from the queue.
Syntax
ui.Interface.frontCall("cordova", "getCallbackData",
[], [result, callback-id])
- result - Holds the result returned from the result queue.
- callback-id - Holds the callback identifier of the Cordova asynchroneous front call.
Usage
When initiating an asynchronous Cordova plugin front call with callWithoutWaiting
,
results are stored in the result queue when the Cordova function terminates, and a
cordovacallback
action is fired if the current dialog defines a corresponding
ON ACTION
handler.
The getCallbackData
front call returns the first Cordova plugin result from the
result queue, and removes it from the queue. A subsequent getCallbackData
front
call gives back the next result and so on.
The first value returned by the front call (result) is the actual result. This
can be a 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).
callWithoutWaiting
front call that is causing this result. For example, for a Media plugin front call, the
callback-id can look like:Media-messageChannel:0
If the result queue is empty, both result and callback-id
are NULL
.
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 res, id STRING
CALL ui.Interface.frontCall("cordova", "getCallbackData",
[], [res, id])