Amplitude-Kotlin
Amplitude-Kotlin copied to clipboard
fix: Remove unsafe Application casts from configuration
Summary
This PR removes unsafe type casts of configuration.context to Application.
We’re using the SDK in Home Widgets, where the provided Context is not always an instance of Application. As a result, the SDK crashes when it attempts to cast the context unsafely.
To improve compatibility and prevent crashes in such environments, this change:
- Removes direct casts to Application
- Uses safe type checks (
is Application) before calling application-specific methods
Checklist
- [x] Does your PR title have the correct title format?
- Does your PR have a breaking change?: No
✅ No documentation updates required.