本文介绍了为PhoneGap Build创建自定义AdMob插件(适用于iOS和Android)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Phonegap Build应用程序中的所有内容都在工作,包括Google Analytics(分析)和FacebookConnect插件。

Everything in my Phonegap Build app is working, including the Analytics and FacebookConnect plugins. However, now I would like to add AdMob ads.

Phonegap Build不提供AdMob内建的外挂程式,但根据,您现在可以添加自己的自定义插件(请参阅页面底部的参与插件)。

Phonegap Build does not provide a built-in plugin for AdMob, but according to the Phonegap Build Plugins page, you can now add your own custom plugins (see Contributing Plugins at the bottom of the page).

Phonegap Build Plugins页面引用了上作为如何设置自定义plugin.xml的示例。下面是Child Browser plugin.xml的内容。

The Phonegap Build Plugins page references the Child Browser plugins.xml on GitHub as an example of how to setup the custom plugin.xml. Below is the content of the Child Browser plugin.xml.

我不知道这个文件的哪些方面需要修改, 。我想我已正确设置Phonegap AdMob插件的文件结构,用于和(请参阅下面的文件结构),但我不知道如何参考

I'm not sure what aspects of this file I need to modify and what to modify them to. I think I have correctly setup the file structure of the Phonegap AdMob Plugins for both iOS and Android (see the file structure below), but I'm not sure how to reference these files correctly in the plugin.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="com.phonegap.plugins.childbrowser"
    version="3.0.4">

    <name>Child Browser</name>

    <asset src="www/childbrowser.js" target="childbrowser.js" />
    <asset src="www/childbrowser" target="childbrowser" />

    <!-- android -->
    <platform name="android">
        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser"
                      android:label="@string/app_name">
                <intent-filter>
                </intent-filter>
            </activity>
        </config-file>

        <!-- Cordova 1.5 - 1.9 -->
        <config-file target="res/xml/plugins.xml" parent="/plugins">
            <plugin name="ChildBrowser"
                value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
        </config-file>

        <!-- Cordova 2.0.0 -->
        <config-file target="res/xml/config.xml" parent="/cordova/plugins">
            <plugin name="ChildBrowser"
                value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
        </config-file>

        <source-file src="src/android/ChildBrowser.java"
                target-dir="src/com/phonegap/plugins/childBrowser" />
    </platform>
    <!-- ios -->
    <platform name="ios">
        <plugins-plist key="ChildBrowser"
                    string="ChildBrowserCommand" />

        <resource-file src="ChildBrowser.bundle" />
        <resource-file src="ChildBrowserViewController.xib" />

        <header-file src="ChildBrowserCommand.h" />
        <header-file src="ChildBrowserViewController.h" />

        <source-file src="ChildBrowserCommand.m" />
        <source-file src="ChildBrowserViewController.m" />
    </platform>
</plugin>

应用程式档案结构

/index.html
/config.xml
  /adMob
    /plugin.xml
    /src
      /iOS
        /GADAdMobExtras.h (from AdMob iOS SDK)
        /GADAdNetworkExtras.h (from AdMob iOS SDK)
        /GADAdSize.h (from AdMob iOS SDK)
        /GADBannerView.h (from AdMob iOS SDK)
        /GADBannerViewDelegate.h (from AdMob iOS SDK)
        /GADInterstitial.h (from AdMob iOS SDK)
        /GADInterstitialDelegate.h (from AdMob iOS SDK)
        /GADRequest.h (from AdMob iOS SDK)
        /GADRequestError.h (from AdMob iOS SDK)
        /libGoogleAdMobAds.a (from AdMob iOS SDK)
        /AdMobPlugin.h (from Phonegap Plugin for iOS)
        /AdMobPlugin.js (from Phonegap Plugin for iOS)
        /AdMobPlugin.m (from Phonegap Plugin for iOS)
      /android
        /AdMobPlugin.java (from Phonegap Plugin for Android)
        /AdMobPlugin.js (from Phonegap Plugin for Android)
        /GoogleAdMobAdsSdk-6.2.1.jar (from AdMob Android SDK)








Phonegap Plugin for iOS
AdMob iOS SDK
Phonegap Plugin for Android
AdMob Android SDK

推荐答案

这是一个老的未回答的问题,因为今天是不可能的。但Phonegap已经宣布更改其规则:

I'm the author of the plugin and you can see a live demo app (for Android only) here

这篇关于为PhoneGap Build创建自定义AdMob插件(适用于iOS和Android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 23:57