Android SDK
IMGA Event Centre Android SDK
Introduction
This sample app shows how to integrate the IMGA front row seat SDK into an Android application.
Supported IDEs:
Android Studio
Supported build systems:
Gradle
Adding the library to the project
Using Github Packages Maven repository
Add the repository to your build.gradle file
Add the package dependencies to your build.gradle file
Adding the library locally to the project
Copy the eventcentre.aar to the libs folder of your application:
Then include the event centre in the dependencies section of your application:
Usage
Initialising the SDK
Configuration parameters
operator
string
your unique operator Id name
sport
string
"golf"
version
string
the version of the Event Centre
eventId
string
refers to the event you wish to display
targetModule
string
specifies the module that the app should display
language
string
ISO code for the language of the translations
Golf Modularisation
The Event centre supports being initialised in seven different modular configurations, Provide the required module to the library:
full
All Event Centre
-
leaderboard
Leaderboard Only (no global navigation)
-
leaderboarddetail
Leaderboard & Team/Player (no global navigation)
-
course
Course & Hole Only (no global navigation)
-
hole
Hole Only (No navigation back to Course)
holeNo must be passed in initialContext, see below for more details
groupdetail
Groups List & Group Detail
-
groups
Group Only
-
Sample initialisation for Golf:
Creating the Event Center instance
Event Centre: Emitting Messages
The emitMessage method is available on the instance of the eventCentre, it is used to send messages to the Event Centre. Only supported message topics will be passed to the Event Centre.
The EventCentreMessageTopics enumcontains the following values:
HANDSHAKE_FAILED: Dedicated topic to signify the handshake between Event Centre and your site failed to complete. This topic is emitted by the integration library, it should only be subscribed to, not emitted.
CONTEXT_UPDATE: Topic for covering general UI state updates, for example navigation changes or the user selecting a player in the UI.
SELECTION_UPDATE: Dedicated topic for handling user selection updates. The selected field within the message data handles both selecting and deselecting updates.
ERROR: Topic sent if the SDK had any problem to be initialised. This topic is emitted by the integration library, it should only be subscribed to, not emitted.
The EventCentreMessage type is an alias of a HashMap<String, Any> class. Keys must be Strings and the Values can be any type.
Updating the Context
There is a convenience method to update the context:
This method will update the context of the widget, and receives only the parameter context of type EventCentreContext. This type is a subclass of EventCentreMessage.
GOLF context params
view
string
The name of the active view
tournamentId
number or string
Identifier for the tournament
roundNo
number or string
The round the user is currently viewing data from
holeNo
number or string
The hole the user is currently viewing data from
playerNo
number or string
The player's ID
groupNo
number or string
The group's ID
courseId
number or string
The course's ID
Event Centre: Receiving Messages
In order to subscribe to different messages emitted by the SDK, the EventCentreListener interface must be implemented.
Subscribing to status changes
The SDK will send every change in its status using the following Listener method:
The EventCentreStatus enum contains the following values:
INITIALISING: the SDK is initialising and not fully loaded.
ACTIVE: the SDK is ready to interact.
EMITTING_MESSAGE: the SDK is emitting a message.
INACTIVE: the SDK is closed and can't receive any message.
Subscribing to new messages
To receive context or selection updates from the SDK, the host app must subscribe to the Listener using this method:
The EventCentreMessageTopics enumcontains the following values:
HANDSHAKE_FAILED: Dedicated topic to signify the handshake between Event Centre and your site failed to complete. This topic is emitted by the integration library, it should only be subscribed to, not emitted.
CONTEXT_UPDATE: Topic for covering general UI state updates, for example navigation changes or the user selecting a player in the UI.
SELECTION_UPDATE: Dedicated topic for handling user selection updates. The selected field within the message data handles both selecting and deselecting updates.
ERROR: Topic sent if the SDK had any problem to be initialised. This topic is emitted by the integration library, it should only be subscribed to, not emitted.
Stop the sdk
IMGA SDK is owned and maintained by the IMGA Development team.
Last updated