Phonegap で最初のアプリケーションを作成しています。FileOpener、Downloader、stausBarNotification などのプラグインを作成しました。プラグインは次のようなものです。
FileOpener.js は次のようになります。
cordova.define("cordova/plugin/fileopener",
function(require, exports, module) {
var exec = require("cordova/exec");
var FileOpener = function () {};
FileOpener.prototype.open = function(url) {
exec(null, null, "FileOpener", "openFile", [url]);
};
var fileOpener = new FileOpener();
module.exports = fileOpener;
});
/**
* Load Plugin
*/
if (!window.plugins) {
window.plugins = {};
}
if (!window.plugins.fileOpener) {
window.plugins.fileOpener = cordova.require("cordova/plugin/fileopener");
}
Downloader.jsは次のようになります。
cordova.define("cordova/plugin/downloader",
function(require, exports, module) {
var exec = require("cordova/exec");
var Downloader = function () {};
Downloader.prototype.downloadFile = function(fileUrl, dirName, fileName, overwrite, win, fail) {
navigator.notification.alert('url: '+fileUrl+' to dir: '+dirName + ' to file: '+fileName);
if (overwrite == false)
overwrite = "false";
else
overwrite = "true";
exec(win, fail, "Downloader", "downloadFile", [ fileUrl, dirName, fileName, overwrite ]);
};
var downloader = new Downloader();
module.exports = downloader;
});
if (!window.plugins) {
window.plugins = {};
}
if (!window.plugins.downloader) {
window.plugins.downloader = cordova.require("cordova/plugin/downloader");
}
また、実装するJavaファイルもいくつか作成しました。Androidデバイスで期待どおりに実行されるようになりました。しかし今、私はios用に同じプロジェクトが必要で、build.phonegap.comがそれをしてくれることを望んでいます。
次のようにconfig.xmlにプラグインを含めました。
<gap:plugin name="FileOpener" value="com.phonegap.plugins.fileOpener.FileOpener"/>
<gap:plugin name="Downloader" value="com.phonegap.plugins.downloader.Downloader"/>
<gap:plugin name="StatusBarNotification" value="com.phonegap.plugins.statusBarNotification.StatusBarNotification"/>
さて、ここからどこへ行こう?プラグインを phonegap.com に送信するように指示している記事を読みましたが、どうすればよいですか? プロジェクトは iPhone の Android デバイスと同じように動作しますか? 事前に助けてくれてありがとう。