class HorizonServiceConnection
instance
: HorizonServiceConnection
[Get] |
Acquire a reference to the Horizon Platform instance, which can be used to make raw requests and sessions. You probably shouldn't ever need to use this.
Signature
val instance: HorizonServiceConnection |
connect
(
applicationId
, context
, scope
, config
)
|
Initialize the Horizon Platform. This method must be called before any other service methods can be executed.
The lifecycle of this connection is determined by the HorizonServiceConnection.Companion.connect passed into this method. Prefer scopes which do not terminate on background, as several common features require your app to move to the background in order to function.
Activity-scoped Lifecycle:
// MainActivity.kt onCreate HorizonServiceConnection.connect(APPLICATION_ID, context, lifecycleScope)
ViewModel-scoped Lifecycle:
class MyViewModel: ViewModel() {
init {
HorizonServiceConnection.connect(APPLICATION_ID, context, viewModelScope)
}
}
Signature
fun connect(applicationId: String, context: Context, scope: CoroutineScope), config: HorizonPlatformConfig = HorizonPlatformConfig()) Parameters
applicationId:
String
context:
Context
scope:
CoroutineScope
config:
HorizonPlatformConfig
|
data class InitializationFailed(val error: Throwable) : HorizonServiceConnection.InitializationStage
InitializationFailed
(
error
)
|
Signature
constructor(error: Throwable) Parameters
error:
Throwable
Returns
HorizonServiceConnection.InitializationStage.InitializationFailed
|
error
: Throwable
[Get] |
Signature
val error: Throwable |
sealed class InitializationStage