-
Notifications
You must be signed in to change notification settings - Fork 253
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
BaseLocationManager.putIntoMap crashes on Android 12+ with a ClassCastException:
java.lang.Long cannot be cast to java.lang.Integer.
Environment
- Library version: 3.3.0 (also reproduces on 3.4.0)
- React Native version: 0.73.9
- Android version/device: Android 12, Xiaomi 11 Lite 5G NE (real device)
Steps to reproduce
- Call
Geolocation.getCurrentPosition(or start observing location). - When Google Play services populates
Location.getExtras()with Long values
(e.g. GNSS satellite count), the library tries to cast to Integer.
Stack trace
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at com.reactnativecommunity.geolocation.BaseLocationManager.putIntoMap(BaseLocationManager.java:53)
at com.reactnativecommunity.geolocation.BaseLocationManager.locationToMap(BaseLocationManager.java:38)
...
Expected behaviour
Extras should be forwarded without crashing (Long should be handled safely).
Proposed fix
Treat any Number generically or handle Long before Integer.
I can send a PR with the change if that helps.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working