-
Notifications
You must be signed in to change notification settings - Fork 551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Administrative area in Location Detection #2637
base: development
Are you sure you want to change the base?
Conversation
object : LocationListener { | ||
override fun onLocationChanged(location: Location?) { | ||
if (location == null) { | ||
emitter.onError(java.lang.IllegalStateException()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What IllegalState?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given for the condition if incase it fails to update location to the variable then it gives the error for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see that message in IllegalStateException constructor. How would I know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I remove the it? or I had a question is there need of AdminArea if we are implementing it using cityName if not then should I change the method for calling the admin area with the city name as it will also save from creating another function for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you should throw error with a proper message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I will fix it soon
?: return Single.error(IllegalStateException()) | ||
val geoCoder = Geocoder(context, Locale.getDefault()) | ||
|
||
return Single.create { emitter -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add single cancel handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create a memory leak when Single is cancelled. Add logic to handle the cancellation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
Fixes #2459 The location is not displayed properly
Changes:
Previously on clicking on detect my location it showed the Administrative Area made it to display the City Name as it would be more specific.
Screenshots for the change:
Previously

After Changing
