Triton Mobile SDK for Android
Classes | Public Member Functions | Static Public Attributes | List of all members
com.tritondigital.player.StreamUrlBuilder Class Reference

Helps create station stream URLs. More...

Classes

enum  ListenerIdType
 

Public Member Functions

 StreamUrlBuilder (Context context)
 Constructor.
 
StreamUrlBuilder addQueryParameter (String key, boolean value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, char value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, double value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, float value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, int value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, long value)
 /copydoc addQueryParameter(String, String)
 
StreamUrlBuilder addQueryParameter (String key, String value)
 Adds a key/value pair to the URL query parameters. More...
 
String build ()
 Returns an URL from the previously set data. More...
 
StreamUrlBuilder enableLocationTracking (boolean enable)
 Enables the location tracking using the device's location manager. More...
 
String getHost ()
 Returns the player host.
 
HashMap< String, String > getQueryParameters ()
 Returns the query parameters.
 
StreamUrlBuilder resetQueryParameters ()
 Clears the the previously set query.
 
StreamUrlBuilder setHost (String host)
 Sets server host with the mount.
 

Static Public Attributes

static final String AGE = "age"
 int - Age (1 to 125) More...
 
static final String BANNERS = "banners"
 String (comma-separated list) - Banner capabilities More...
 
static final String COUNTRY_CODE = "country"
 String - Country code (ISO 3166-1 alpha-2) More...
 
static final String CUSTOM_SEGMENT_ID = "csegid"
 int - Custom segment ID (1 to 1000000) More...
 
static final String DATE_OF_BIRTH = "dob"
 String - Date of birth formatted as "YYYY-MM-DD" More...
 
static final String DIST = "dist"
 
static final String DIST_BACKUP = "dist-backup"
 
static final String DIST_TIMESHIFT = "dist-timeshift"
 
static final String GENDER = "gender"
 char - Gender ('m' or 'f')
 
static final char GENDER_VALUE_FEMALE = 'f'
 Possible StreamUrlBuilder.GENDER value.
 
static final char GENDER_VALUE_MALE = 'm'
 Possible StreamUrlBuilder.GENDER value.
 
static final char GENDER_VALUE_OTHER = 'o'
 
static final String LATITUDE = "lat"
 float - Latitude (-90.0f to 90.0f) More...
 
static final String LONGITUDE = "long"
 float - Longitude (-180.0f to 180.0f) More...
 
static final String POSTAL_CODE = "postalcode"
 String - Postal/ZIP code More...
 
static final String YEAR_OF_BIRTH = "yob"
 int - Year of birth (1900 to 2005) More...
 

Detailed Description

Helps create station stream URLs.

This class helps you create a stream URL with tracking parameters. The user tracking ID and location is automatically added when calling build(). This class can also be used to create the stream parameters for TritonPlayer.

A basic validation is done when adding a query parameter.

Member Function Documentation

◆ addQueryParameter()

StreamUrlBuilder com.tritondigital.player.StreamUrlBuilder.addQueryParameter ( String  key,
String  value 
)

Adds a key/value pair to the URL query parameters.

The key and value will be encoded.

◆ build()

String com.tritondigital.player.StreamUrlBuilder.build ( )

Returns an URL from the previously set data.

This method also refreshes the user tracking id and the location.

◆ enableLocationTracking()

StreamUrlBuilder com.tritondigital.player.StreamUrlBuilder.enableLocationTracking ( boolean  enable)

Enables the location tracking using the device's location manager.

Enabling this feature will overwrite the StreamUrlBuilder.LATITUDE and StreamUrlBuilder.LONGITUDE query parameters.

See Android location manager.

AndroidManifest.xml Permissions
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Member Data Documentation

◆ AGE

final String com.tritondigital.player.StreamUrlBuilder.AGE = "age"
static

int - Age (1 to 125)

Clients/players must specify only one of StreamUrlBuilder.AGE, StreamUrlBuilder.DATE_OF_BIRTH or StreamUrlBuilder.YEAR_OF_BIRTH.

◆ BANNERS

final String com.tritondigital.player.StreamUrlBuilder.BANNERS = "banners"
static

String (comma-separated list) - Banner capabilities

Players can provide details on their level of support for banners, such as banner sizes and formats.

The ordering of the capability formats is not important.

Note
Before attempting to use player capability targeting, please contact the Triton Digital Support Team to enable Player Capability Targeting for your broadcaster. Currently, Player Capability Targeting only works with Tap advertising.
Supported Formats
CapabilityDescription
970x250 IAB Billboard (970x250)
120x60 IAB Button 2 (120x60)
300x600 IAB Half Page/Filmstrip (300x600)
728x90 IAB Leaderboard (728x90)
970x100 IAB Leaderboard (970x100)
300x250 IAB Medium Rectangle (300x250)
88x31 IAB Microbar (88x31)
300x1050 IAB Portrait (300x1050)
970x90 IAB Pushdown (970x90)
180x150 IAB Rectangle (180x150)
320x480 IAB Smartphone Portrait (320x480)
300x50 IAB Smartphone Static Banner (300x50)
320x50 IAB Smartphone Static Wide Banner (320x50)
300x300 IAB Square (300x300)
970x66 IAB Super Leaderboard (970x66)
160x600 IAB Wide Skyscraper (160x600)
Client-defined (w x h)Custom banner size

◆ COUNTRY_CODE

final String com.tritondigital.player.StreamUrlBuilder.COUNTRY_CODE = "country"
static

String - Country code (ISO 3166-1 alpha-2)

Not required individually. If using, however, we recommend that you specify StreamUrlBuilder.POSTAL_CODE.

◆ CUSTOM_SEGMENT_ID

final String com.tritondigital.player.StreamUrlBuilder.CUSTOM_SEGMENT_ID = "csegid"
static

int - Custom segment ID (1 to 1000000)

Broadcasters that want to differentiate their listeners into custom broadcaster-specific segments may use the Custom Segment Targeting capability of Tap.

Note
Before use by players, please contact the Triton Digital Support Team to enable Custom Segment ID Targeting for your broadcaster. Currently, Custom Segment ID Targeting only works with Tap advertising.

◆ DATE_OF_BIRTH

final String com.tritondigital.player.StreamUrlBuilder.DATE_OF_BIRTH = "dob"
static

String - Date of birth formatted as "YYYY-MM-DD"

Clients/players must specify only one of StreamUrlBuilder.AGE, StreamUrlBuilder.DATE_OF_BIRTH or StreamUrlBuilder.YEAR_OF_BIRTH.

◆ LATITUDE

final String com.tritondigital.player.StreamUrlBuilder.LATITUDE = "lat"
static

float - Latitude (-90.0f to 90.0f)

Not required individually. If using, you must specify StreamUrlBuilder.LONGITUDE.

◆ LONGITUDE

final String com.tritondigital.player.StreamUrlBuilder.LONGITUDE = "long"
static

float - Longitude (-180.0f to 180.0f)

Not required individually. If using, you must specify StreamUrlBuilder.LATITUDE.

◆ POSTAL_CODE

final String com.tritondigital.player.StreamUrlBuilder.POSTAL_CODE = "postalcode"
static

String - Postal/ZIP code

Valid postal or ZIP code, without spaces. E.g., 89040 or H3G1R8.

Not required individually. If using, however, we recommend that you specify StreamUrlBuilder.COUNTRY_CODE.

◆ YEAR_OF_BIRTH

final String com.tritondigital.player.StreamUrlBuilder.YEAR_OF_BIRTH = "yob"
static

int - Year of birth (1900 to 2005)

Clients/players must specify only one of StreamUrlBuilder.AGE, StreamUrlBuilder.DATE_OF_BIRTH or StreamUrlBuilder.YEAR_OF_BIRTH.