<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="cordova-plugin-admobpro-ex"
        version="2.50.0">
      
    <name>AdMob Plugin Pro</name>
    <description>Ultimate Cordova Plugin for Google AdMob and DFP to monetize hybrid apps. Show mobile Ad with single line of JavaScript. Compatible with Cordova CLI, PhoneGap Build, Intel XDK/Crosswalk, Google ChromeApp, Ionic, Meteor, etc.</description>
    <author>The author is a thief</author>
    <license>MIT</license>
    <keywords>rjfun,admob,google,ad</keywords>
    <repo>https://github.com/realmee/cordova-plugin-admobpro-ex.git</repo>
    <issue>https://github.com/realmee/cordova-plugin-admobpro-ex/issues</issue>

    <engines>
        <engine name="cordova-android" version="&gt;=3.5.0" />
        <engine name="cordova-ios" version="&gt;=3.5.0" />
    </engines>

    <js-module src="www/AdMob.js" name="AdMob">
        <clobbers target="window.AdMob" />
    </js-module>

    <dependency id="cordova-plugin-extension" />

    <preference name="ADMOB_ANDROID_APP_ID" default=""/>
    <preference name="ADMOB_IOS_APP_ID" default=""/>
    <preference name="PLAY_SERVICES_VERSION" default="19.0.1"/>

    <!-- android, now build with gradle instead of ant -->
    <platform name="android">
        <!-- you can specify another play services version to avoid conflict with another plugin -->

        <!-- from play service v17.0.0, admob app id is required to avoid app crash -->
        <!-- preference name="ADMOB_APP_ID" default=""/ -->

        <!-- cordova CLI using gradle and it working well -->
	    <framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />

        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
                      android:name="com.google.android.gms.ads.AdActivity"
                      android:theme="@android:style/Theme.Translucent" />
            <meta-data
                android:name="com.google.android.gms.ads.APPLICATION_ID"
                android:value="$ADMOB_ANDROID_APP_ID"/>
        </config-file>
        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        </config-file>

        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="AdMob">
                <param name="android-package" value="com.rjfun.cordova.admob.AdMobPlugin"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>
        <source-file src="src/android/AdMobMediation.java" target-dir="src/com/rjfun/cordova/admob" />
        <source-file src="src/android/AdMobPlugin.java" target-dir="src/com/rjfun/cordova/admob" />
    </platform>
     
    <!-- same as android, but use ant instead of gradle -->
    <platform name="amazon-fireos">
        <!-- amazon-fireos still using ant, AND default android r19 -->
        <!-- framework src="com.google.android.gms:play-services-ads:+" /-->
        <dependency id="cordova-plugin-googleplayservices"/>

        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
                      android:name="com.google.android.gms.ads.AdActivity"
                      android:theme="@android:style/Theme.Translucent" />
        </config-file>
        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        </config-file>

        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="AdMob">
                <param name="android-package" value="com.rjfun.cordova.admob.AdMobPlugin"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>
        <source-file src="src/android/AdMobMediation.java" target-dir="src/com/rjfun/cordova/admob" />
        <source-file src="src/android/AdMobPlugin.java" target-dir="src/com/rjfun/cordova/admob" />
     </platform>

    <!-- ios -->
    <platform name="ios">
        <!-- GoogleMobileAds.framework in dependency plugin: cordova-admobsdk, > 100MB -->
        <dependency id="cordova-admobsdk" version="~7.49.0"/>

        <config-file target="config.xml" parent="/*">
            <feature name="AdMob">
                <param name="ios-package" value="CDVAdMobPlugin" />
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <config-file target="*-Info.plist" parent="GADApplicationIdentifier">
            <string>$ADMOB_IOS_APP_ID</string>
        </config-file>

        <header-file src="src/ios/CDVAdMobPlugin.h"/>
        <source-file src="src/ios/CDVAdMobPlugin.m"/>
        <header-file src="src/ios/AdMobMediation.h"/>
        <source-file src="src/ios/AdMobMediation.m"/>
    </platform>

    <!-- Windows Phone 8 -->
    <platform name="wp8">
        <framework src="src/wp8/GoogleAds.dll" custom="true" />

        <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
            <Capability Name="ID_CAP_LOCATION" />
        </config-file>
        <config-file target="config.xml" parent="/*">
            <feature name="AdMob">
                <param name="wp-package" value="AdMobPlugin"/>
            </feature>
        </config-file>
        <source-file src="src/wp8/AdMobPlugin.cs" />
        <source-file src="src/wp8/AdMobOptions.cs" />
    </platform>
</plugin>
