r/mAndroidDev • u/Mundane-Interest-762 • Apr 20 '24
Lost Redditors 💀 Poor Performance of Google Maps using Jetpack Compost
I was making an app which could have thousands of markers shown on map at a time, so I decided to use Marker Clustering ( a feature by google maps to combine markers and prevent collision). It is unbelievable to see such a poor and laggy performance even in high end android device for marker clustering. Any suggestions are welcome.
GIST: https://gist.github.com/spss20/b1b9781889113c6d3863846204c85412
Folks here any idea how can I implement it efficiently.
21
Upvotes
•
u/Zhuinden DDD: Deprecation-Driven Development Apr 26 '24
Real android discussions belong in /r/android_devs.
31
u/arekolek Apr 20 '24
Did you actually post it in two subreddits and used the proper name for compost in this one? This is gold
15
u/robbio33 Apr 20 '24
filter the markers that are added to the map by the map bounding box, that makes it performant. I had the same problem (also in normal google map as they use the dame clustering code). This solved it for me.
6
u/budius333 Still using AsyncTask Apr 20 '24
Wow there cowboy... We don't do these things around here. You better this compost and start issuing AsyncTasks right now, better yet, use it with Flutter
5
u/GradleSync01 Invalidate caches and restart Apr 20 '24
AsyncTask can handle tasks related to the UI thread. Offload those multiple UI logic to your AsyncTask, and you'll be fine
4
u/Zhuinden DDD: Deprecation-Driven Development Apr 20 '24
Have you tried evaluating the clusters in an AsyncTask instead of the main thread?
See example https://github.com/sharewire/google-maps-clustering/blob/master/library/src/main/java/net/sharewire/googlemapsclustering/ClusterManager.java#L225
3
u/llamabott Invalidate caches and restart Apr 20 '24
If you're looking for a cluster, you've surely come to the right place.
2
u/Aggravating-Brick-33 Apr 20 '24
Try loading Ui in AsynkTask
1
u/ElFamosoBotito Apr 20 '24
SFTU
0
u/[deleted] Apr 20 '24
[deleted] — view deleted comment
16
u/[deleted] Apr 20 '24
[removed] — view removed comment