Skip to main content

Google PAL

The fl-ads-pal library integrates with Google PAL library to enable publishers make a direct call to monetize Android Applications.

Create Configuration

Create a PALSessionConfiguration with the configuration which is needed. 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. The events for the playback can be captured through this session.

val palSession = PALFactory.createPALSession(
context,
palConfiguration,
allowStorage = false,
logger
)

Get Nonce

In order to get the Nonce from Google PAL you need to call the method initialize from the PALSession instance, and the callback function that will be used to return the value of Nonce once Google PAL return 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 the playback events to PALSession

Send Playback Start

In order to notify to Google server that playback is started you need to call the method sendPlaybackStart without any parameters.

palSession.sendPlaybackStart()

Send Playback End

In order to notify to Google server that playback is ended you need to call the method sendPlaybackEnd without any parameters.

palSession.sendPlaybackEnd()

Send Click

In order to notify to Google server that ad playback is clicked you need to call the method sendClick without any parameters.

palSession.sendClick()

Send Gestures

In order to notify to Google server about any touch interaction with the player, you need to call the method onVideoViewTouch.

palSession.onVideoViewTouch(motionEvent)