Question
It takes a long time for the location service to obtain location information when using the @ohos.geoLocation Manager interface. How to solve it?
Short Answer
The delay occurs because the precision-first policy waits for both GNSS and network positioning results. In poor GPS environments (such as indoors), GNSS cannot provide results, so only the network result is returned after the timeout period, causing a long wait.
To improve performance:
- Use the speed-first policy if high precision is not required.
- If precision is required, keep the precision-first policy but add a loading page to notify users about potential delays.
Applicable Scenarios
- Indoor or weak GPS environments
- Apps that do not require high-accuracy location
- Apps requiring high precision with user feedback/loading UI
- Situations where user experience must be improved during long location retrieval
Top comments (0)