问题描述
我想在我的PhoneGap的应用程序,以显示插播式广告,但它不工作;它不是在所有的显示广告。我跟着指示。
I'm trying to display interstitial Ad in my PhoneGap app but it's not working; it's not displaying the ad at all. I followed the instructions here.
除了试图使其工作,怎么还需要做的是展现在特定的时间(可能是当游戏结束),间质,但我不知道如何来指代从JavaScript在Java code code,显示加载插页式广告。
Apart from trying to make it work, what I also need to do is to show the interstitial at a particular time (probably when the game is over) but I dont know how to refer to the Java code from JavaScript code to show the loaded interstitial ad.
请帮忙。
推荐答案
我最近买了AdMob中的科尔多瓦4项目中工作之后,很多摆弄。忘了你在你的问题联系到的指令,而不是为科尔多瓦/ PhoneGap的生成。
I recently got AdMob working within my Cordova 4 project after much fiddling. Forget the instructions you linked to in your question, which are not for cordova/phonegap builds.
第1步:您将需要安装科尔多瓦/ PhoneGap的插件适用于AdMob。 (这是假设你已经)。在我的情况,例如,对于科尔多瓦命令行界面,我用终端, CD
我的项目的根目录,然后键入:
Step 1: You will need to install the Cordova/Phonegap plugin for Admob. (This assumes you have already created the project files.) In my case, e.g. for Cordova command line interface, I used Terminal, cd
to my project's root directory and then type:
cordova plugin add com.admob.google
有关您的PhoneGap的设置,你可能会需要做的下列操作之一
For your Phonegap setup, you will likely need to do one of the following:
添加到您的项目的config.xml文件。
Add this to your project's config.xml file.
<gap:plugin name="com.admob.google" source="plugins.cordova.io" />
或(适用于PhoneGap的CLI),从项目的根目录下键入此命令到终端,
OR (for Phonegap CLI), type this command into Terminal from your project's root directory,
phonegap local plugin add com.admob.google
一旦你的插件,你可以使用JavaScript来控制AdMob联播行为。
Once you have the plugin, you can use javascript to control Admob behavior.
第2步:适用于AdMob插件适当的javascript添加到您的项目,在你的index.html文件链接。我遇到了一些麻烦,在这里,所以只是为了证明自己的插件确实有效,我删除(备份)从我的项目的WWW文件夹中的一切,从的后来的。两者的工作。就在那时做的事聪明,人比我在我的应用程序的JavaScript的工作。
Step 2: Add appropriate javascript for Admob plugin to your project, linked in your index.html file. I ran into some trouble here, so just to prove to myself that the plugin really works, I removed (backed up) everything from my project's WWW folder and added the exact files from the WWW folder from this project and later this one on Github. Both work. It was then a matter of making smarter-people-than-myself's javascript work in my app.
的一些技巧
- 请不要使用仿真器。 AdMob的可能不会在模拟器正确地执行。
- 出于某种原因,我不是在LTE / 4G服务AdMob广告。如果你确定你已经正确地完成全部的寄托,尽量将设备连接到WIFI测试时
- 如果您的应用程序仍然没有工作,你不知道什么elese做,尽量。无效的HTML会影响JavaScript的性能。
- 确保您已经添加
&LT;脚本类型=文/ JavaScript的SRC =cordova.js&GT;&LT; / SCRIPT&GT;
在你的头上你索引文件。
- Don't use the emulator. Admob may not perform correctly in the emulator.
- For some reason, I am not served Admob ads over LTE/4G. If you are certain you have done everthing correctly, try connecting your device to WIFI when testing
- If your app is still not working, and you don't know what elese to do, try to validate your HTML. Invalid html will affect performance of javascript.
- Make sure you have added
<script type="text/javascript" src="cordova.js"></script>
in your head of your index file.
这篇关于Interstatial AdMob联播使用PhoneGap的不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!