Amplitude-Kotlin icon indicating copy to clipboard operation
Amplitude-Kotlin copied to clipboard

fix: Remove unsafe Application casts from configuration

Open kmsbernard opened this issue 5 months ago • 1 comments

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

kmsbernard avatar Jun 27 '25 02:06 kmsbernard

✅ No documentation updates required.

promptless[bot] avatar Jun 27 '25 02:06 promptless[bot]