ApplicationInitializer

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:

  1. Subclass ApplicationInitializer

  2. 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))
    }
    }
    }
  3. Add the subclass to AndroidManifest

     <provider
    android:authorities="your.package.name"
    android:name=".AppStartupProvider"
    android:exported="false" />

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.

Functions

Link copied to clipboard
abstract fun initialize(): (Application) -> Unit

Perform Olo Pay SDK initialization here