Skip to main content

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

PropertyTypeDescription
willAdAutoPlayBooleanDefines whether the ad will be auto played without waiting for user interaction or not.
willAdPlayMutedBooleanDefines whether the ad will be played while muted or not.
continuousPlaybackBooleanDefines whether the player intends to continuously play the content videos one after another similar to TV broadcast or video playlist.
descriptionUrlURLDefines the description URL of the content during which the ad will be played.
iconsSupportedBooleanDefines whether VAST icons are supported by the video player.
nonceLengthLimitIntDefines the length limit of the generated nonce.
omidPartnerNameStringThe name of the partner integrating OMID measurement.
omidPartnerVersionStringThe version of the partner integrating OMID measurement.
omidVersionStringThe version of OMID that the player responsible for ad playback integrates with.
playerTypeStringThe partner provided player type.
playerVersionStringThe partner provided player version.
ppidStringThe publisher provided ID.
videoHeightIntThe height of the ad video element.
videoWidthIntThe 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)