initializeManually
@JvmStatic
@JvmName(name = "initializeManually")
Triggers manual initialization of the SDK and waits for it to complete.
This suspend function should only be used if automatic initialization has been disabled.
Important: The SDK requires the application to be in the foreground to bind to the payment service. It is recommended to call this method when the Activity is in the RESUMED state.
Example (Modern Approach)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
val state = InPersonPaymentsTools.initializeManually(this@MainActivity)
if (state is InitializationState.SuccessfulInitialization) {
// SDK is ready.
}
}
}
}Content copied to clipboard
Example (Legacy Approach)
override fun onResume() {
super.onResume()
lifecycleScope.launch {
val state = InPersonPaymentsTools.initializeManually(this@MainActivity)
// ...
}
}Content copied to clipboard
Parameters
context
The application context.