Installation
Via Cordova CLI:
cordova plugin add cordova-admob-plus --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx --variable APP_ID_IOS=ca-app-pub-xxx~xxx
For Android developer, com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION is available for configuration, the default is --PLAY_SERVICES_VERSION=19.6.0.
When using with other plugins and encountering errors, try the following to fix.
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
or add <preference name="AndroidXEnabled" value="true" /> to config.xml for Cordova>=9.
For iOS developer,
- Add
<preference name="SwiftVersion" value="5.3" />to the section<platform name="ios">inconfig.xml - After adding this preference, you need to run
cordova platform remove iosthencordova platform add iosto take effect - Run
pod repo updateorcd platforms/ios && pod install --repo-updateto ensure latest SDK is ready
With Consent SDK
In order to fulfill GDPR, it is important to ask user's consent before displaying personalized ads.
Install cordova-plugin-consent and following the example code.
cordova plugin add cordova-plugin-consent
Using Ionic
Refer to the ionic guide to get started.