NonceManager

public final class NonceManager extends Object

Manages a nonce and its event reporting for a single content playback session.

The below content playback session lifecycle methods must be accurately called in order to enable programmatic monetization.

Public Method Summary

String
getNonce()
Gets the nonce generated for this manager when it was loaded.
void
sendAdClick()
Notifies Google ad servers that a clickthrough on an ad has occurred during the given content playback session.
void
sendAdImpression()
This method is deprecated. Use sendPlaybackStart() and sendPlaybackEnd() instead.
void
sendAdTouch(MotionEvent motionEvent)
Notifies Google ad servers that a user touch or click on the ad other than a clickthrough (e.g.
void
sendPlaybackEnd()
Notifies Google ad servers that playback for the given content playback session has ended.
void
sendPlaybackStart()
Notifies Google ad servers that playback for the given content playback session has started.

Inherited Method Summary

Public Methods

public String getNonce ()

Gets the nonce generated for this manager when it was loaded.

This value will never change for a given NonceManager instance. This nonce value is only valid for a single content playback session up to a maximum duration of 6 hours.

public void sendAdClick ()

Notifies Google ad servers that a clickthrough on an ad has occurred during the given content playback session.

public void sendAdImpression ()

This method is deprecated.
Use sendPlaybackStart() and sendPlaybackEnd() instead.

Notifies PAL that the first frame of the ad has been rendered, so that it can properly update or send signals.

This is a no-op and will be removed in a future release.

public void sendAdTouch (MotionEvent motionEvent)

Notifies Google ad servers that a user touch or click on the ad other than a clickthrough (e.g. skip, mute, tap, etc.) has occurred during the given content playback session.

Parameters
motionEvent The touch event triggered by the user.

public void sendPlaybackEnd ()

Notifies Google ad servers that playback for the given content playback session has ended. This should be called when playback ends (e.g. when the player reaches end of stream, or when the user exits playback mid-way, or when the user quits the app or page, or when advancing to the next content item in a playlist setting).

This method ends the asynchronous calls to Google servers started in sendPlaybackStart.

public void sendPlaybackStart ()

Notifies Google ad servers that playback for the given content playback session has started. This should be called on "video player start". This may be in response to a user-initiated action (click-to-play) or an app or page initiated action (autoplay).

This method will start asynchronous calls to Google servers to collect signals needed for IVT monitoring and detection.