App Startup Initializers

The UI Components library relies on Jetpack App Startup Initializers to initialize certain components. These run automatically when you include the UI Components library and start your application.

In some cases, you might wish to prevent the automatic initialization, for example, to decrease your app's initial startup time. You can do this by following the Manually initialize components guide from the Android Developers documentation.

Warning:

Removing the automatic initializers and not running the initializers manually will result in crashes when using the UI Components.

You'll have to do the following:

  1. Disable the auto-initialization of the UI Components library by adding the following to your Manifest:
<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <meta-data
        android:name="io.getstream.chat.android.ui.initializer.ChatUIInitializer"
        tools:node="remove" />
</provider>
  1. Do the initialization manually, before any of the Stream UI Components are used in your application.
AppInitializer.getInstance(appContext).initializeComponent(ChatUIInitializer::class.java)
Note:

You need to have a dependency on the App Startup library to access AppInitializer.

Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Chat Android v7: <Your Question>