GeoFirebase icon indicating copy to clipboard operation
GeoFirebase copied to clipboard

no marker created

Open aryayudha opened this issue 9 years ago • 2 comments

why no marker on my maps?

aryayudha avatar Oct 04 '17 06:10 aryayudha

Greetings

If you could please provide some code and explanation so I can help you more it would be great. However, I'm committed to helping anyone who honored me by using my humble library. So I'm gonna guess...

You are not getting any marker on the map because the library helps you with getting the data, what you do with the data later is another deal. As you can see in the final part of the main Readme.md file a future task could be creating a sort of FirebaseRecyclerAdapter for the map.

You should try something like this:

        new GeoEvent<GeoPlace>(
                current.latitude,
                current.longitude,
                GeoDistances.TWO_KM,
                GeoPlace.class,
                "locations",
                countryIso
        ) {
            @Override
            protected void results(List<GeoPlace> geoPods) {
                 //Here, this is what you are looking for, when you get the data then put each object in the map
                for (GeoPlace geoPlace : geoPods) {
                    LatLng latLng = new LatLng(geoPlace.getLatitude(), geoPlace.getLongitude());
                    Marker marker = googleMap.addMarker(new MarkerOptions().position(latLng));
                    marker.setTag(geoPlace);
                }
            }
        };

You can see the full file here

In the future I'm not sure if I'm going to support this library anymore, Firebase has released a new product which directly solves the problem that this library was addressing: queries with double arguments, latitude and longitude in this case. I recommend you to look at Firestore

Please let me know if this suffices or you need further assistance. Thanks for using my library :)

cutiko avatar Oct 04 '17 13:10 cutiko

i try to run your example code, but still nothing change.

aryayudha avatar Oct 04 '17 13:10 aryayudha