我是PhoneGap和移动PayPal的新手。我在我的PhoneGap应用程序中尝试了 https://github.com/azicchetti/MECLPayPalPlugin 插件,并且可以与模拟器一起使用。
现在我想发送到PhoneGap Build在真实手机中进行测试。但是根据Phonegap Build文档,如果我们上传像.java这样的本机文件,我们的应用程序很可能会无法编译。那么,当我需要发布我的应用程序时,如何将PayPal服务器更改为此插件中的实时和应用程序 ID ?
谢谢!
Phonegap构建只允许HTML5,CSS文件。 正如您提到的.java不支持文件。因此,如果你想构建你的安卓应用程序,你需要在 eclipse 中构建它,然后它也会将你的 html 代码与PayPal插件打包。
从这里下载拼音库
它包括示例项目,也可以指导您了解 android 的结构和休息,您可以在此处查找文档
在插件.xml文件中定义插件,如下面的示例所示。
<config-file target="res/xml/config.xml" parent="/cordova/plugins">
<plugin name="ChildBrowser"
value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
</config-file>
<source-file src="src/android/ChildBrowser.java"
target-dir="src/com/phonegap/plugins/childBrowser" />
这是我的一个插件.xml文件供您参考。
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.childbrowser"
version="3.0.4">
<name>Child Browser</name>
<asset src="www/childbrowser.js" target="childbrowser.js" />
<asset src="www/childbrowser" target="childbrowser" />
<!-- android -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser"
android:label="@string/app_name">
<intent-filter>
</intent-filter>
</activity>
</config-file>
<!-- Cordova 1.5 - 1.9 -->
<config-file target="res/xml/plugins.xml" parent="/plugins">
<plugin name="ChildBrowser"
value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
</config-file>
<!-- Cordova 2.0.0 -->
<config-file target="res/xml/config.xml" parent="/cordova/plugins">
<plugin name="ChildBrowser"
value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
</config-file>
<source-file src="src/android/ChildBrowser.java"
target-dir="src/com/phonegap/plugins/childBrowser" />
</platform>
<!-- ios -->
<platform name="ios">
<plugins-plist key="ChildBrowser"
string="ChildBrowserCommand" />
<resource-file src="ChildBrowser.bundle" />
<resource-file src="ChildBrowserViewController.xib" />
<header-file src="ChildBrowserCommand.h" />
<header-file src="ChildBrowserViewController.h" />
<source-file src="ChildBrowserCommand.m" />
<source-file src="ChildBrowserViewController.m" />
</platform>
还有一件事要补充将您的插件包含在 config.xml 文件中
<plugin name="MECLPayPalPlugin" value="com.phonegap.plugins.paypal.MECLPayPalPlugin"/>
如果您没有插件.xml当前项目中的文件,请在res/xml/plugins下创建它.xml