IBM工作灯6.1 - 科尔多瓦插件没有得到执行 [英] IBM Worklight 6.1 - Cordova plug-in not getting executed
问题描述
我试图使用IBM工作灯营造科尔多瓦插件。我跟着href=\"http://www.ibm.com/developerworks/mobile/worklight/getting-started.html#cordova\" rel=\"nofollow\"> IBM工作灯入门页,但在检查尝试它的设备我得到以下的:
I am trying to create a Cordova Plugin using IBM Worklight. I followed the instructions mentioned in the IBM Worklight Getting Started page, but while checking trying it on a device I get the following:
17 02-13:58:15.182:D /插件管理(21057):EXEC()调用未知
插件:SamPlugin
02-13 17:58:15.182: D/PluginManager(21057): exec() call to unknown plugin: SamPlugin
我添加在插件的的Config.xml 如下:
<plugin name="SamPlugin" value="com.samapp.plugins.samplugin.SamPlugin"/>
然后,我打电话从我的的JavaScript 文件的插件如下:
cordova.exec(success,failure,"SamPlugin","printMsg",[name]);
有没有错误,而建设中的应用。结果
我需要提到插件其他地方?
There are no errors while building the application.
Do I need to mention the plugin anywhere else?
推荐答案
在我看来像您已声明在config.xml中插件的方式是不正确...
Looks to me like the way you have declared the plug-in in config.xml is incorrect...
这
<plugin name="SamPlugin" value="com.samapp.plugins.samplugin.SamPlugin"/>
应该是:
<feature name="SamPlugin">
<param name="android-package" value="com.testapp.SamPlugin" />
</feature>
以上是科尔多瓦插件都在科尔多瓦宣布3.X的方式;工作灯6.1采用3.1科尔多瓦
The above is the way Cordova plug-ins are declared in Cordova 3.x; Worklight 6.1 uses Cordova 3.1.
以上假定您使用工作灯6.1,因为你提到你已经按照一个入门培训模块,现在基于工作灯6.1 ... 如果您使用的是不同的工作灯版本,则必须何况版本号
The above assumes you are using Worklight 6.1, because you mentioned that you've followed a Getting Started training module, which is now based on Worklight 6.1... If you are using a different Worklight version, you must mention the version number.
例如 - 一个实现了科尔多瓦的应用插件,共享通过安装在设备上的本地电子邮件应用程序的链接的问题(这其实并不重要,它只是一个情景):
For example - an application that implements a Cordova plug-in that shares a link to a question via the native email app installed on the device (this doesn't really matter, it's just a "scenario"):
HTML:
<button onclick="openExternalApp()">Share Question</button>
JavaScript的:
function openExternalApp() {
var QUESTION_LINK = $(".question_link").attr("href");
cordova.exec(onSuccess, onFailure, "OpenExternalAppPlugin", "openApp", [QUESTION_LINK]);
}
function onSuccess() {
WL.Logger.debug("*** Plug-in executed successfully.");
}
function onFailure() {
WL.Logger.debug("*** Plug-in failed to execute.");
}
的Android \\本地\\水库\\ XML \\ config.xml文件:
<feature name="OpenExternalAppPlugin">
<param name="android-package" value="com.testapp.OpenExternalAppPlugin" />
</feature>
的Android \\本地的\\ src \\ COM \\ YOUR_APP \\ OpenExternalAppPlugin.java:结果
包含科尔多瓦的Java code Java文件插件...
android\native\src\com\YOUR_APP\OpenExternalAppPlugin.java:
The Java file containing the Java code of the Cordova plug-in...
这篇关于IBM工作灯6.1 - 科尔多瓦插件没有得到执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!