openmobilehub / omh-maps

omh-maps
Apache License 2.0
3 stars 1 forks source link

Unable to Get Current Location in App #72

Closed dzuluaga closed 1 year ago

dzuluaga commented 1 year ago

Description

The current implementation of our app fails to retrieve and display the user's current location. Despite calling the necessary functions, the app silently ignores them, resulting in the absence of the expected pin on the map. Furthermore, no error messages are logged, making it difficult to pinpoint the cause of this issue.

Steps to Reproduce

  1. Launch the app.
  2. Navigate to the screen where the current location pin should be displayed.
  3. Observe the absence of the pin representing the user's current location.

Expected Behavior

The app should properly call the required functions and display a pin indicating the user's current location on the map. We expect the Getting Started documentation to include steps to display the current location as part of the basic setup process.

Actual Behavior

The app neglects to execute the necessary functions, leading to the omission of the current location pin. No error messages or log entries provide clues regarding the cause of the problem.

Additional Information

Repository: Link to the GitHub repository

Impact

This issue is urgent as it confuses developers and obstructs progress in the app's development. Immediate attention and troubleshooting are required to resolve this bug.

Your prompt assistance in investigating and rectifying this issue would be highly appreciated. If any further details or clarifications are needed, please let us know.

Thank you for your attention to this matter.

CC - @rquino @prestonlau

hans-hamel commented 1 year ago

I just checked the code. And the problem is that the variable omhLocation from the class is not assigned. It should be assigned like this(without val): omhLocation = OmhMapProvider.getInstance().provideOmhLocation(this)

https://github.com/openmobilehub/omh-maps/assets/124717244/5972c808-5c5b-418f-9dac-69c4bffa7b9f

dzuluaga commented 1 year ago

Thank you for spotting that and investigating. I believe we can prevent this situation from occurring. Considering that omhLocation is only used in one specific location, declaring it as a member variable introduces the potential for errors, as it needs to be initialized in onCreate. To minimize the chances of mistakes, could you please utilize the function getCurrentLocation as a variable instead? Here are some suggestions:

OmhMapProvider.getInstance().provideOmhLocation(this)?.getCurrentLocation(onSuccessListener, onFailureListener)

or if you need to assign omhLocation to a member variable:

OmhMapProvider.getInstance().provideOmhLocation(this)?.let { omhLocation ->
                omhLocation.getCurrentLocation(onSuccessListener, onFailureListener)
            }
hans-hamel commented 1 year ago

Alright, changed.

dzuluaga commented 1 year ago

Where? I still see omhLocation used in this fragment. https://github.com/openmobilehub/omh-maps/blob/release/1.0/maps-sample/src/main/java/com/omh/android/maps/sample/maps/MapFragment.kt#L187. In the future, please provide a link to the link to the commit with the changes. Thanks.

hans-hamel commented 1 year ago

Sorry, probably the change was not merged yet.

dzuluaga commented 1 year ago

LGTM. Thanks!