Network-Key Replacement
This feature enables you to replace the Infeed-Banner placement and Banner Cache network keys with custom values you provide.
It substitutes placeholders enclosed in curly brackets (
{}
) within the ad network key orextraInfo
with corresponding values from your map. For example:request.networkKeyReplacements = mapOf( "key1" to "value1", "key2" to "value2", "anotherKey" to "anotherValue" )
A network key like
1234:{key1}-{anotherKey}
will be transformed into1234:value1-anotherValue
.
Infeed Banner Example
val configuration = BannerConfiguration()
placement = AATKit.createInfeedBannerPlacement("<PLACEMENT_NAME>", configuration)
// Create the banner request instance
val request = BannerRequest(null)
// Set network-key replacement
request.networkKeyReplacements = mapOf(
"key1" to "value1",
"key2" to "value2",
"anotherKey" to "anotherValue"
)
// Perform the request
placement?.requestAd(request, object : BannerRequestCompletionListener {
override fun onRequestCompleted(layout: BannerPlacementLayout?, error: BannerRequestError?) {
// handle error or display the ad
}
})
Banner Cache Example
val configuration = BannerCacheConfiguration("<PLACEMENT_NAME>", 1)
// Create the banner request instance
val request = BannerRequest(null)
// Set network-key replacement
request.networkKeyReplacements = mapOf(
"key1" to "value1",
"key2" to "value2",
"anotherKey" to "anotherValue"
)
// Set configuration banner request
configuration.requestConfiguration = request
// Create the banner cache (once it has been created, it would start loading automatically)
bannerCache = AATKit.createBannerCache(configuration)
Last updated