ApplicationInitializer

abstract class ApplicationInitializer : BaseProvider

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 = {
    OloPayApiInitializer().setup(it.applicationContext, SetupParameters(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

ApplicationInitializer
Link copied to clipboard
fun ApplicationInitializer()

Creates a new ApplicationInitializer instance. There should generally not be a need to call this.

Functions

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

Perform Olo Pay SDK initialization here