Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ Create a Kotlin file in your commonMain e.g. `AppSetup.kt` or however you want t
```Kotlin
import io.sentry.kotlin.multiplatform.Context
import io.sentry.kotlin.multiplatform.Sentry
import io.sentry.kotlin.multiplatform.OptionsConfiguration

// The context is needed for Android initializations
fun initializeSentry(context: Context?) {
Sentry.init(context) {
it.dsn = "__DSN__"
}
fun initializeSentry(context: Context) {
Sentry.init(context, optionsConfiguration())
}

fun initializeSentry() {
Sentry.init(optionsConfiguration())
}

private fun optionsConfiguration(): OptionsConfiguration = {
it.dsn = "__DSN__"
}

```

Now call this function in an early lifecycle stage in your platforms.
Expand Down Expand Up @@ -131,7 +139,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
AppSetupKt.initializeSentry(context = nil)
AppSetupKt.initializeSentry()
return true
}
}
Expand Down