Installation
npx admob-plus install -p cordova
Or via Cordova CLI:
cordova plugin add admob-plus-cordova --save --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx --variable APP_ID_IOS=ca-app-pub-xxx~xxx
- Android
- iOS
com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION
is available for configuration,
the default is --PLAY_SERVICES_VERSION=20.1.0
.
When using with other plugins and encountering errors, set AndroidXEnabled
to true
.
config.xml
<widget>
<platform name="android">
<preference name="AndroidXEnabled" value="true" />
</platform>
</widget>
Or add the following plugins for Cordova<9
,
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
Proguard
Add these rules to your proguard configuration:
-keep public class admob.plugin.ads.** {
public *;
}
Set deployment-target
and SwiftVersion
,
config.xml
<widget>
<platform name="ios">
<preference name="deployment-target" value="12.0" />
<preference name="SwiftVersion" value="5.3" />
</platform>
</widget>
Run cordova platform remove ios
then cordova platform add ios
to take effect.
Run pod repo update
or cd platforms/ios && pod install --repo-update
to ensure latest SDK is ready.