55
66package io.opentelemetry.android
77
8+ import android.app.Application
89import android.content.Context
910import android.util.Log
1011import io.opentelemetry.android.common.RumConstants
@@ -54,7 +55,7 @@ class SdkPreconfiguredRumBuilder internal constructor(
5455 * @return A new [io.opentelemetry.android.OpenTelemetryRum] instance.
5556 */
5657 fun build (): OpenTelemetryRum {
57- if ((context as ? android.app. Application ) == null ) {
58+ if ((context as ? Application ) == null ) {
5859 Log .w(
5960 RumConstants .OTEL_RUM_LOG_TAG ,
6061 " Cannot retrieve applicationContext. This indicates the OpenTelemetry SDK was " +
@@ -65,15 +66,14 @@ class SdkPreconfiguredRumBuilder internal constructor(
6566 }
6667
6768 val enabledInstrumentations = getEnabledInstrumentations()
68- lateinit var openTelemetryRum: OpenTelemetryRumImpl
69- val onShutdown: () -> Unit = {
69+ val openTelemetryRum = OpenTelemetryRumImpl (sdk, sessionProvider, clock)
70+ openTelemetryRum. onShutdown = Runnable {
7071 for (instrumentation in enabledInstrumentations) {
7172 instrumentation.uninstall(context, openTelemetryRum)
7273 }
7374 sdk.shutdown()
7475 onShutdown.run ()
7576 }
76- openTelemetryRum = OpenTelemetryRumImpl (sdk, sessionProvider, clock, onShutdown)
7777
7878 // Install instrumentations
7979 for (instrumentation in enabledInstrumentations) {
0 commit comments