-
-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Problem
Sentry Android init needs the Android context: SentryAndroid.init(context) { }
which is not easily replicated in the common code.
Our current solution involves a hacky
workaround that declares an expect class in commonCode which typealiases to Android context on Android but does nothing on iOS.
common: expect abstract class Context
android: actual typealias Context
iOS: actual abstract class Context
Avoiding context would also mean the user doesn't need to specifically create another init function just for the context which removes some of the burden on them.
Solution
A user pointed to an article/blog with a possible solution for this in discussions: #112
The article: https://proandroiddev.com/how-to-avoid-asking-for-android-context-in-kotlin-multiplatform-libraries-api-d280a4adebd2
Essentially what we would be going to use is the androidx.startup:startup-runtime
package which handles the initialization before the library code - repo
Update:
This can be implemented using a simple internal ContentProvider on KMP Android. The incorporation of the startup library is still something that is being discussed.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status