Richou / react-native-android-location-enabler

Display a GoogleMap like android popup to ask for user to enable location services if disabled
MIT License
202 stars 51 forks source link

addObserver issue fix: using context rather than activity in LocationServices #71

Open vivekvardhanadepu opened 2 years ago

vivekvardhanadepu commented 2 years ago

fixes #67

vatsal-gadhiya-searce commented 2 years ago

@Richou Can we merge this please?

anees17861 commented 2 years ago

@vivekvardhanadepu This doesn't address the actual issue properly. As suggested in the error, it needs to be called in main thread. Instead of using reactContext try surrounding the location api with

new Handler(Looper.getMainLooper()).post(() -> {

})

This should make the call on main thread