Setup the platform
You should perform this once in your application preferrably early well before any adverts will be displayed.
This is a two step process. You should initially call
setup specifying you platform selection and then call
initialise to initialise the platform.
Firstly select the platform:
This simply specifies the platform the extension will use, so the correct implementation will be used for all other functionality. At this point you can use other functionality of the extension around consent and the user messaging platform, however adverts will not function.
This will initialise the actual platforms advertising SDK.
Warning: Ads may be preloaded by the underlying advertising SDK or mediation partner SDKs upon calling
initialise(). If you need to obtain consent from users in the European Economic Area (EEA), set any request-specific flags (such as tagForChildDirectedTreatment or tag_for_under_age_of_consent), or otherwise take action before loading ads, ensure you do so before calling
This is the main reason there are two steps in the process to allow you to acquire consent before loading any ads.
The initialisation process is asynchronous and will take a short amount of time depending on the platform. An event is dispatched when this process is complete.
If you are planning to use "Open Bidding Mediation" then you need to ensure you await the initialised event. Before an open bidding adapter can participate in an ad request, it must first be initialized. The
initialise() method initializes open bidding adapters and dispatches the
AdvertsEvent.INITIALISED event once all adapters complete initialisation (or after a 30 second timeout).
The initialised event will contain details of the available mediator adapters, including their state and latency:
You can also check whether a platform is supported before initialising it to dynamically swap platforms,
by using the