# Application Initialization Bubbl must be initialized once at app startup. ## Step 1: Create a custom `Application` class File: `app/src/main/java/.../MyApplication.kt` ```kotlin class MyApplication : Application() { override fun onCreate() { super.onCreate() // Initialize Firebase first if (FirebaseApp.getApps(this).isEmpty()) { FirebaseApp.initializeApp(this) } // Initialize Bubbl BubblSdk.init( application = this, config = BubblConfig( apiKey = "YOUR_API_KEY", environment = Environment.PRODUCTION, segmentationTags = emptyList(), geoPollInterval = 5 * 60_000L, defaultDistance = 10 ) ) } } ``` ## Why this order matters - Firebase must be ready before the SDK registers for notifications. - Bubbl needs an `Application` context because it lives across activities. ## Optional: dynamic API key storageThe host app lets testers swap API keys without rebuilding. ```kotlin TenantConfigStore.load(this)?.let { cfg -> BubblSdk.init( application = this, config = TenantConfigStore.toBubblConfig(cfg) ) } ``` Tooltip If you have a fixed API key, you can hardcode it and skip `TenantConfigStore` entirely.