stop()

From Engineering Client Portal

Engineering Portal / Digital / Android SDK API Reference / stop()
Stops measurement progress. Call stop() in following situations:

  • When user initiates content pause and the content can be resumed from the same position.
  • When current content is changing, such as a channel change (Call stop() on current content and call play() & loadMetadata() on new content).
  • When content is interrupted by external app or process (phone call, Network loss + empty buffer, power / standby activated, alarm).
    • For audio only: Android has two kinds of audio focus requests – soft and hard.
      • Soft requests are usually temporary interruptions, such as alarm, incoming call on some systems which only ‘duck’ or lower the volume but do not indicate that audio focus was lost. These are acceptable to not call stop() on.
      • Hard requests are usually streaming apps like YouTube, Pandora, etc. which should properly indicate the audio focus was lost – stop() can be called for those.
      • Another case to be covered for hard requests is when the camera’s video record is engaged. This, often, will interrupt audio playback. However on Android, there is no guarantee that it will come as a hard request across all devices.
      • When an ad ends.
  • When content has completed (Call stop() followed by either a postroll ping or an end() call).
  • Anytime when whole screen is occluded (for video content)

Syntax

public void stop()

Input Parameters

Parameter Description
None

Output Parameters

Output Parameters (Return value) Description
void

Notes

  • It is very important that the SDK calls stop() whenever necessary.

In case of a missing stop() call, App SDK identifies the change to next play() and inserts a stop() call (functionally in the background). This allows the downstream systems to track the stop() calls.