1

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 デバイスと同じように動作しますか? 事前に助けてくれてありがとう。

4

1 に答える 1

0

プラグインを送信するには、 https://build.phonegap.com/docs/plugins-contributingにあるドキュメントに従ってください。提出されると、それは審査され、一般に公開されます。利用可能なプラグインのリストは、https: //build.phonegap.com/plugins で確認できます。

于 2013-09-03T09:56:30.593 に答える