Question

Is it possible to pass Array to phonegap plugin in android from javascript interface ? Im using phonegap 2.7 version

Was it helpful?

Solution

Yes it is possible to pass array from Java Script to Native i.e Plugin

cordova.exec(function(winParam) {}, function(error) {}, "service", "action", ["firstArgument", "secondArgument", "thirdArgument",
                     "fourthArgument"]);

The parameters are detailed below:

function(winParam) {}: Success function callback. Assuming your exec call completes successfully, this function is invoked (optionally with any parameters you pass back to it).

function(error) {}: Error function callback. If the operation does not complete successfully, this function is invoked (optionally with an error parameter).

"service": The service name to call into on the native side. This is mapped to a native class, and it is defined in config.xml.

"action": The action name to call into. This is picked up by the native class receiving the exec call, and, depending on the platform, essentially maps to a class's method.

[Array of Data, separated by ',']: Arguments to pass into the native environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top