The Central Hub component gives you a complete social betting experience in a single Android surface. It combines profiles, shared bets, search, notifications, following, onboarding, and leaderboards.
This guide shows you how to:
Prerequisites
jwtToken String required — authenticates the user and initializes the component.userId String required — identifies the currently signed-in user.onBack () -> Unit required — closes the Central Hub and returns control to your app.modifier Modifier optional — Compose layout control.onGetBets (suspend () -> List<BetPayload>)? optional — provides betslips the user can share.onCopyToBetSlip (BetPayload) -> Unit optional — handles copied shared bets.uiSettings CentralHubUISettings optional — customizes theme, fonts, icons, and behavior.The Central Hub manages its own internal navigation for profiles, followers, search, notifications, comments, and bet sharing flows.
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import androidx.core.view.WindowCompat
import ag.sportradar.virtualstadium.uisdk.composables.CentralHub
import ag.sportradar.virtualstadium.datasdk.model.BetPayload
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
CentralHub(
jwtToken = "<your-jwt-token>",
userId = "<your-user-id>",
modifier = Modifier.fillMaxSize(),
onGetBets = {
getUserBetSlips()
},
onCopyToBetSlip = { betPayload ->
addBetToSlip(betPayload)
},
onBack = {
finish()
}
)
}
}
private suspend fun getUserBetSlips(): List<BetPayload> {
return emptyList()
}
private fun addBetToSlip(betPayload: BetPayload) {
// Add the copied bet to your own bet slip flow.
}
}The profile area can show:
The bets area supports:
The leaderboard area supports:
The component also includes:
To enable sharing, implement onGetBets so the component can show betslips the user is allowed to share.
data class BetPayload(
val betType: BetType,
val selections: List<Selection>,
val stake: Double,
val totalOdds: Double,
val potentialWin: Double,
)CentralHub(
jwtToken = jwtToken,
userId = userId,
onGetBets = {
fetchUserBetSlips()
},
onCopyToBetSlip = { copiedBet ->
addToBetSlip(copiedBet)
},
onBack = { finish() }
)Use CentralHubUISettings to align the component with your app's design system.
You can customize:
val customUISettings = CentralHubUISettings(
theme = CentralHubThemeSettings(
background = Color(0xFFF5F5F5),
buttonColors = CentralHubButtonsColors(
primaryBackground = Color(0xFF1976D2),
primaryContent = Color.White,
),
),
fontFamily = myCustomFontFamily,
icons = CentralHubIcons(
sportIcons = { sportId ->
when (sportId) {
"1" -> R.drawable.ic_custom_soccer
else -> R.drawable.ic_sport_default
}
}
),
otherSettings = CentralHubOtherSettings(),
)If you use Android Views, destroy the component when the user logs out or when the host screen is being torn down.
Always call destroy() on CentralHubView during logout so user-specific Central Hub state is cleared correctly.
class MainActivity : ComponentActivity() {
private lateinit var centralHubView: CentralHubView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
centralHubView = findViewById(R.id.central_hub_view)
centralHubView.init(
jwtToken = jwtToken,
userId = userId,
onBack = { finish() }
)
}
fun onUserLogout() {
centralHubView.destroy()
navigateToLogin()
}
}Review the Android chat integration flow and related callbacks.
See how standalone profile screens work outside Central Hub.
Explore the underlying providers that power the Central Hub experience.