手动安装设备插件(和其他人)到科尔多瓦3.0科尔、插件、其他人、多瓦

2023-09-03 22:46:55 作者:旅人

的PhoneGap /科尔多瓦3.0已经进入了模块化设计开始与3.0版。例如,要调用 device.version API,你需要包括设备插件安装到您的项目。

Phonegap/Cordova 3.0 has moved into a modular design starting with version 3.0. For example, to call the device.version API, you need to include the Device plugin into your project.

任何人都可以向我提供有关如何安装设备(或其它)科尔多瓦API插件安装到一个新的iOS项目明确指示(用X code)和Android(使用Eclipse)?

Anyone can provide me with clear instructions on how to install the Device (or any other) cordova API plugin into a new iOS project (using XCode) AND Android (using Eclipse)?

所有我能找到的是使用Node.js的和/或PlugMan细节。需要一个自动化的脚本来执行添加插件的基本工作是不可取的给我,因为我不喜欢流程做的事情,我不明白(幕后)。

All I could find is details using Node.js and/or PlugMan. Needing an automated script to do the basic job of adding a plugin is undesirable to me, as I do not like processes doing things I don't understand (behind the scene).

在过去(科尔多瓦2.9),我做了以下增加一个第三方插件中(比如Android的)是完美工作:

In the past (cordova 2.9), I did the following to add a third-party plugin in (say Android) that worked perfectly:

把该插件的.java code到/ src文件夹 把该插件的.js code在我的WWW文件夹 导入的.js文件到index.html的 添加功能标记config.xml中 调用插件在Javascript中 Put the plugin .java code into the /src folder Put the plugin .js code in my www folder Import the .js file into index.html Add the feature tag in config.xml Call the plugin in Javascript

我从来没有在之前的iOS添加插件。

I never added plugins in iOS before.

不过,我认为上述过程应该只是罚款科尔多瓦为基础的插件,但事实并非如此。到现在为止,我没有尝试Android的,但我想的iOS没有运气。

However, I assumed the above process should work just fine for cordova-based plugins, but it did not. Up to this point, I did not try Android, but I tried iOS with no luck.

我列入 CDVDevice.h CDVDevice.m 中/ plugins文件夹。此外,我进口device.js到的index.html,并修改config.xml中!只有iOS的整理后,我会尝试Android系统。

I included CDVDevice.h and CDVDevice.m in /plugins folder. Also I imported the device.js into index.html, and modified config.xml! I will try Android only after finishing iOS.

请,如果你知道如何做到这一点手动让我知道。

Please, if you know how to do this manually let me know.

感谢你在前进。

推荐答案

我碰到了同样的问题。

事实上,插件系统并没有太大的改变。

In fact, the plugin system has not changed much.

我添加了日期选择器插件为Android刚才:

I added the date picker plugin for Android just now :

添加类(.M .H为iPhone,的.java为Android) 您要添加js文件 添加在你的index.html链接js文件 编辑config.xml文件(您使用哪个操作系统路径依赖):

<plugin name="DatePickerPlugin" value="com.phonegap.plugins.DatePickerPlugin"/>

您将添加一个功能,这样的(什么是革命!):

You will add a feature (what a revolution !) like this :

<feature name="DatePickerPlugin" >
    <param name="android-package" value="com.phonegap.plugins.DatePickerPlugin"/>
</feature>

这就是它!

如果您不能确定有关参数名称OS语法,你可以使用一个命令,这个添加默认科尔多瓦插件:

If you are not sure about the OS syntax for param name, you can add a default cordova plugin using a command as this one :

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

更多信息有: http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

More info there : http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface