Application Initializer
Convenience provider class to initialize the Olo Pay SDK without needing to create an Application subclass
Usage Details:
To initialize the Olo Pay SDK (and perhaps other libraries that need the application context) do the following:
Subclass ApplicationInitializer
Override ApplicationInitializer.initialize and call OloPayApiInitializer.setup
class AppStartupProvider : ApplicationInitializer() {
override fun initialize(): (Application) -> Unit = {
CoroutineScope(Dispatchers.IO).launch {
OloPayApiInitializer().setup(it.applicationContext, SetupParameters(OloPayEnvironment.Test, false))
}
}
}Content copied to clipboardAdd the subclass to AndroidManifest
<provider
android:authorities="your.package.name"
android:name=".AppStartupProvider"
android:exported="false" />Content copied to clipboard
Important:
This is not the only way to initialize the Olo Pay SDK. See ApplicationProvider for an alternative approach as well
Constructors
Link copied to clipboard
constructor()
Creates a new ApplicationInitializer instance. There should generally not be a need to call this.