Google PAL
The fl-ads-pal library integrates with the Google PAL library to enable publishers to make a direct call to monetize Android Applications.
Create configuration
Create a PALSessionConfiguration with the configuration you need. The following snippet shows configuration creation with sample configuration values.
val palConfig = PALConfiguration(
willAdAutoPlay = true,
descriptionUrl = URL(contentURL),
iconsSupported = false,
omidPartnerName = "Appname",
omidPartnerVersion = "",
omidVersion = "",
playerType = "FL PLayer",
playerVersion = PlayerLibraryInfo.VERSION,
ppid = "some id"
)
PALConfiguration properties
| Property | Type | Description |
|---|---|---|
| willAdAutoPlay | Boolean | Defines whether the ad will be auto played without waiting for user interaction or not. |
| willAdPlayMuted | Boolean | Defines whether the ad will be played while muted or not. |
| continuousPlayback | Boolean | Defines whether the player intends to continuously play the content videos one after another similar to TV broadcast or video playlist. |
| descriptionUrl | URL | Defines the description URL of the content during which the ad will be played. |
| iconsSupported | Boolean | Defines whether VAST icons are supported by the video player. |
| nonceLengthLimit | Int | Defines the length limit of the generated nonce. |
| omidPartnerName | String | The name of the partner integrating OMID measurement. |
| omidPartnerVersion | String | The version of the partner integrating OMID measurement. |
| omidVersion | String | The version of OMID that the player responsible for ad playback integrates with. |
| playerType | String | The partner provided player type. |
| playerVersion | String | The partner provided player version. |
| ppid | String | The publisher provided ID. |
| videoHeight | Int | The height of the ad video element. |
| videoWidth | Int | The width of the ad video element. |
Create PAL session
Create a PALSession for every playback. You can capture the events for the playback through this session.
val palSession = PALFactory.createPALSession(
context,
palConfiguration,
allowStorage = false,
logger
)
Get nonce
To get the nonce from Google PAL, you need to call the initialize method from the PALSession instance, and provide the callback function that is used to return the value of Nonce once Google PAL returns it.
val nonce = palSession.initialize()
when (nonce) {
is Result.Failure -> {
logger.error("Failed to fetch Google PAl nonce: ${nonce.value}")
}
is Result.Success -> {
logger.info("Google PAL nonce generated successfully: ${nonce.value}")
}
}
Session events
Trigger the following events to notify playback events to PALSession.
Send playback start
To notify the Google server that playback has started, call the sendPlaybackStart method without any parameters.
palSession.sendPlaybackStart()
Send playback end
To notify the Google server that playback has ended, call the sendPlaybackEnd method without any parameters.
palSession.sendPlaybackEnd()
Send click
To notify the Google server that ad playback was clicked, call the sendClick method without any parameters.
palSession.sendClick()
Send gestures
To notify the Google server about any touch interaction with the player, call the onVideoViewTouch method.
palSession.onVideoViewTouch(motionEvent)