Android SDK (Core)
NW EXP SSAI – Ad Config Support
9 min
what it is when exp needs to play ads, it can’t do it alone it asks the app for an ad config as string with this info, exp can grab the right ads and play them at the right time api sharedflow → think of this as exp raising its hand whenever it needs ad config completabledeferred → the app’s job is to answer by filling in the string and handing it back how it flows exp raises a request through adconfig the app listens in when a request pops up, the app builds the config string ( mockbuildadconfigstring() \[mock function]) the app hands it back with deferred complete(string) exp takes that and goes to the ad server to fetch ads compose example non compose example breaking down the core code adconfig → this is the channel where exp asks for ad config collect { deferred > } → the app is now “tuned in,” waiting for requests each request comes as a completabledeferred\<string> deferred complete(mockbuildadconfigstring()) → the app builds the string and hands it straight back to exp warnings & fallbacks be careful when completing the deferred if you send back null or an invalid config string, exp may fail to talk to the ad server in some cases, this can even block playback entirely (no ads, no stream) always make sure buildadconfigstring() returns a valid, non empty string add proper error handling or fallback defaults to avoid breaking playback summary adconfig is a simple back and forth between the app and exp exp asks the app listens and replies with the ad config exp uses it to pull in the right ads it’s just a quick handshake to make sure ads play the way they should