-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix: Explore map does not refresh after enabling location #6600
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi, @Inuth0603 |
Hi @rohit9625, apologies for skipping that step! I have just commented on the issue requesting assignment. Thanks for guiding me. |
|
No problem :) |
- Added hadLocationPermissionOnPause field to track permission state - Only refresh map when permission changes from denied to granted - Prevents unnecessary refreshes during normal app lifecycle events
|
On a fresh install, as soon as I open the Explore map, I get the permissions dialog. I choose allow this time. However, it doesn't take me to my current location. |
- Added isWaitingForFirstLocation flag to track when waiting for first GPS fix - Updated handleLocationUpdate to center map when first location arrives - Modified locationPermissionGranted to wait for location instead of calling onMapReady immediately - Fixes issue where map doesn't center on first-time permission grant
@RitikaPahwa4444 Thanks for catching that! I've pushed a fix for the first-time permission grant issue. The problem was: When users grant permission for the first time via the in-app dialog, The fix:
This should now work for both scenarios: Could you test again when you get a chance? You can test by:
Thanks for the thorough testing! 🙏 |
|
@Inuth0603 I just tested your branch by freshly installing the app, opened the Explore Map and choosed allow this time in the permission dialog and still it doesn't take me to my current location |
…sion grant - Use locationManager.getLastLocation() directly instead of cached getLastLocation() - Add isWaitingForFirstLocation flag to handle first GPS fix after permission grant - Update onResume() to detect when permission granted but no cached location - Update performMapReadyActions() to not default to London when waiting for location - Update onLocationPermissionGranted() callback to properly handle fresh permission grant - Center map when first location arrives via handleLocationUpdate() Fixes issue where map showed London instead of user's actual location on fresh install
@Kota-Jagadeesh Apologies for the late response! I've simplified the implementation - removed the timeout complexity for a cleaner approach. The new flow: When permission is granted:
The key improvement: Removed timeout/Handler complexity. Now it simply waits for the location callback, which is more reliable. Could you test once more? The map should center as soon as GPS gets a fix (usually 5-15 seconds outdoors, may take longer indoors). Thanks for your patience testing this! 🙏 |
|
I just tested the branch with the updated commit multiple times and this is what i am able to get : |
Thanks for testing! The video shows it working exactly as expected (waiting for the location callback before centering). Let me know if you think this is ready, or if I should tweak anything else! |
@Inuth0603 In the video, I tapped the recenter button to center my location. I don’t see any difference compared to the main branch. |
- Added recenterMarkerToPosition() call in performMapReadyActions() for all location scenarios - Set mapCenter properly when coming from Nearby map, having real location, or using default - Ensures blue dot marker appears at user's actual location after permission grant
@Kota-Jagadeesh Thanks for the video and the sharp eye! You were absolutely right to flag this. I realized that while the map camera was technically panning to the correct coordinates (moving from London ➡️ Clappana automatically), the Location Layer (Blue Dot) wasn't activating until you clicked the button. Without that visual indicator, the feature felt incomplete. I have just pushed a fix that explicitly enables the visual location marker immediately upon permission grant. Now, the map should center and the Blue Dot should appear automatically without any extra clicks. Ready for a final check when you have a moment! |
|
✅ Generated APK variants! |
Fixes #6599
Changes
onPauseandonResumewithinExploreMapFragment.kt.Testing
Technical Approach
The fix tracks permission state across the pause/resume lifecycle using a boolean flag (
hadLocationPermissionOnPause). This prevents the common issue where checking permissions inonResume()triggers refreshes on every app resume, not just when permissions actually change.