question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Making Nearby locations load faster

See original GitHub issue

Summary:

Problem :

There is a significant lag in the loading of nearby locations ( about 3-4 seconds in normal network conditions).

This may be due to two reasons :

  1. Time interval in getting the location information from device
  2. Time interval in getting the desired number of nearby locations from api

Proposed Solution :

The solution to 1st problem may be to use the FusedLocationApi to immediately get the last known location. And for the second problem is to make the nearby locations to load asynchronously in the background as and when the nearby locations are loaded one by one and update the Recycler Views in the UI.

Screencast

link

Code

I saw this code snippet in NearbyPlaces which gets the nearby location places by querying wikidata. We can asynchronously do this and update the Recycler views in the UI to quickly display the loaded results first by using the notifydataset() function. This may provide faster results to the user.

try {
            // increase the radius gradually to find a satisfactory number of nearby places
            while (radius <= MAX_RADIUS) {
                places = getFromWikidataQuery(curLatLng, lang, radius);
                Timber.d("%d results at radius: %f", places.size(), radius);
                if (places.size() >= MIN_RESULTS) {
                    break;
                } else {
                    radius *= RADIUS_MULTIPLIER;
                }
            }
        }

Device and Android version: Android 6.0.1

Commons app version: 2.6.7-debug-master

Would you like to work on the issue?

Yes

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pshcommented, Mar 16, 2018

The algorithm steps outward and performs multiple queries. If it updated the GUI each time it received data then you would start seeing results quicker - you’d see the circle of map pins expand - in a series of steps. Your’re right that each query takes a while before showing results, but, there’s no point forcing the user to sit there if we do have usable data to give them.

0reactions
nicolas-raoulcommented, Feb 15, 2019

@HaricharanDharmaji There is a server-side timeout (I believe it is 30 seconds or one minute) which is probably why Nearby just loads nothing sometimes.

Would you mind watching the output of adb logcat when loading Nearby? You might spot things that might help the project progress. Thanks! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make Google Maps load faster - Android
If Google Maps loads slowly, here are a few things you can try. ... Google Maps stores data like shared locations, saved locations,...
Read more >
9 Quick Ways to Improve Page Loading Speed - HubSpot Blog
With that in mind, let's take a look at nine easy ways to make your pages load faster. 1. Choose a performance-optimized hosting...
Read more >
20 Ways to Speed Up Your Website and Improve Conversion ...
Even a 1-second delay in your website`s load time can lead to lower revenue and traffic. Try these 20 tips to speed up...
Read more >
10 Ways to Make Your Website Load Faster - Hostway
Learn 10 ways to make your website load faster today. ... and they deliver from the server closest to the user's physical location....
Read more >
Loading locations faster in ArcGIS Network Analyst?
I was wondering whether there is a faster way to load my locations (origins, destinations and barriers) because my current rate is around...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found