如何使用PhoneGap的構建

在config.xml中插件能夠用來經過配置插件(爲每一個應用程序構建phonegap構建服務,你須要有一個config.xml文件在你的根文件夾)。

據Cordova隊公佈,Cordova註冊表已過期,全部的插件都搬到了npm, 並改名爲"cordova-plugin-xxx"。

在你的config.xml文件:
<uses-permission android:name="android.permission.RECORD_AUDIO" />或
<uses-feature android:name="android.hardware.microphone" android:required="false" />

使用那個插件標識?
請注意,有兩個插件之間的一些細微的差異:
• cordova-plugin-admobpro, 在你的Android SDK中它使用默認的jar,須要構建Gradle的Android apk。看到它的plugin.xml:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

• cordova-plugin-admob,它依賴於一個插件包含了google-play-services.jar,可使用這些工具代替Gradle。看到它的plugin.xml:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

PhoneGap構建是否支持Gradle?
請檢查來自PhoneGap構建的新聞在他們的網頁:https://github.com/
• 2015/9/29: Android的創建使用PhoneGap4+,如今使用@phonegapbuild 上的Gradle!查看博客:https://github.com/...更多的信息和警告!

• 2015/9/30:在新的Android gradle構建上有一些問題!咱們已經再次恢復默認構建與ant。很抱歉的麻煩。

• 2015/9/30: @PhoneGapBuild會將gradle問題更新排序。

示例
查看所有config.xml文件:https://github.com/
而後你能夠在你的javascript代碼中調用AdMob插件(deviceready事件觸發以後)。
你的index.html:
               keymob.isInterstitialReady(function (isReady) {
               if (isReady) {
               alert("Interstitial is load success,you can show it now");
                   }
              });

              keymob.showInterstitial()
              keymob.isInterstitialReady(function (isReady) {
               if (isReady) {
                keymob.showInterstitial();
            }
        });

        function onAdReceive(message) {
        if(message.adtype==keymob.AdTypes.INTERSTITIAL){
        alert(message.adtype + message.adapter+" ,you can show it now");
                                        }
      //keymob.showInterstitial();//show it when received
                                 }
document.addEventListener(keymob.AdEvent.ON_LOADED_SUCCESS, onAdReceive, false);

創建與APP的PhoneGap構建
把你的代碼放置在https://github.com/,歷來源於https://github.com/的PhoneGap構建添加應用。
這是用一個簡單的PhoneGap構建演示項目(與index.html和config.xml)。
https://github.com/創建並獲得你的應用程序包,若是構建經過。javascript

相關文章
相關標籤/搜索