Mobile Ads Settings
Before starting, first you must configure the SDK via EMASettings instance.
If you have the user's consent on displaying personalized ads, you may set
Some properties of
EMASettings are for testing and debugging purposes.
The optional parameters are:
isAdsDisabled: The default value is
false. Set this value
trueif you don't want your users to see ads.
isUserLoggedInWithFB: Default value is
false. Used for targeting. Set this value to
trueif the current user is logged in via Facebook.
logLevel: the default value is
LogLevel.NONE. Set this value to
LogLevel.ALLto print out all debug messages.
testingType: The default value is
AdTestingType.NONE. This may be used to test the DFP Banner Ads, DFP Interstitial Ads, AdMob Banner Ads, AdMob Interstitial Ads or IMA Preroll Ads. Please don't forget to remove this setting before submitting your app to the Google Play Store.
testDevies: If you'd like to test the ads via your device's testing id then add the value to this property. Please don't forget to remove this setting before submitting your app to Google Play Store!
Initializing the SDK
After configuring the SDK with at least the required parameters, you must call
sendAppView method of
EMAManager.instance, which initializes the SDK and sends a broadcast message of type
EMAAdBroadcastType.ADS_READY_FOR_DISPLAY once the initialization is complete. This only needs to be done once, ideally at the application launch. Please also note that
EMAManager.instance.isAdsReadyForDisplay is set to
true once the initialiation process is completed.
You can also add AppViewParserListener through EMAManager.instance.appViewParserListener property to listen sendAppView events with
onFailedAppViewParse. Note that sendAppView may get called multiple times in one session.