在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