/** * Receives a request for execution and fulfills it by finding the appropriate * Java class and calling it's execute method. * * PluginManager.exec can be used either synchronously or async. In either case, a JSON encoded * string is returned that will indicate if any errors have occurred when trying to find * or execute the class denoted by the clazz argument. * * @param service String containing the service to run * @param action String containing the action that the class is supposed to perform. This is * passed to the plugin execute method and it is up to the plugin developer * how to deal with it. * @param callbackId String containing the id of the callback that is execute in JavaScript if * this is an async plugin call. * @param rawArgs An Array literal string containing any arguments needed in the * plugin execute method. */ public void exec(final String service, final String action, final String callbackId, final String rawArgs) { if (numPendingUiExecs.get() > 0) { numPendingUiExecs.getAndIncrement();//获取并自增 this.ctx.getActivity().runOnUiThread(new Runnable() { public void run() { execHelper(service, action, callbackId, rawArgs); numPendingUiExecs.getAndDecrement();//获取并自减 } }); } else { execHelper(service, action, callbackId, rawArgs); } }
代码如上,小弟最近在看cordova,对于 PluginManager.exec can be used either synchronously or async,这句很不理解,希望大神们帮助解答一下,还有cordova是怎么实现同步和异步的?最好详细一些,小弟对此研究不深.
相关推荐
phonegap/Cordova和android自定义插件模块,cordova build后插件不会消失
PhoneGap/Cordova的支付宝Android插件
百度移动广告联盟phonegap/cordova插件,百度ssp广告phonegap插件,支持cordova和phonegap打包的ios和android应用,简单好用,只需要几行js就能在phonegap和cordova应用里面接入百度广告
InstagramPlugin, 用于 phonegap/cordova的Instagram 插件 Cordova Instagram 插件由 。使用dataUrl和Android的Instagram 应用程序添加用于共享画布元素或者编码图像的内容的能力。 将插件安装到你的项目中如果使用...
通过自定义plugin插件实现了javascript与Android的交互。
win7(32位)环境下phonegap(cordova)环境的搭建过程,花了2天时间整理的,对初学者应该有所帮助。
cordova扫码插件phonegap-plugin-barcodescanner,修复了在ios10上面的内存泄漏导致的闪退bug
Phonegap项目中,使用js脚本调用ios中OC代码,需要使用Phonegap提供的一个脚本插件:cordova.js
移动开发框架
cordova-plugin-pingpp, Ping 支付 Cordova / PhoneGap 插件
基于undroid的phoneGap(cordova)开发步骤代码
该项目文件集成了Cordova自带的通讯录插件,以及自己封装好的Cordova插件,可添加打开通讯录
phonegap cordova 最简单的android应用例子,直接执行cordova run android 进行编译后可以在手机上浏览效果
基于cordova1.7版本,将api中实例汇总在一起并在iphone4s机器上调试通过
一款很实用的CORDOVA PHONEGAP插件
已经装eclipse,android sdk及adt的安装和配置。 1.进入eclipse界面,新建android工程 new > android project 2.该工程目录下建立两个文档 /libs 和 /assets/www 3.把phonegap中android目录下的cordova-1.7.0.js...
最新版本的phonegap-2.9.1是没有cordova-2.9.1.jar的,这里打包好给大家。
睡眠定时器 PhoneGap/Cordova 插件平台支持此插件支持在 iOS 和 Android 上运行的 PhoneGap/Cordova 应用程序。版本要求此插件适用于 Cordova 3.5.0+。安装使用 PhoneGap/Cordova CLI(iOS 和 Android)自动安装在...
cordova-screenshot, cordova/phonegap的屏幕截图插件 cordova-screenshot 屏幕截图插件允许你的应用屏幕截图,并将它们保存到手机。如何安装通过cordova安装它cordova plugin add https://github.com/gitawego/c
使用phonegap(Cordova)快速集成H5界面,速成app。适用性强,一套H5界面,多个平台使用。