How set Custom Info Window in .net maui Android?

Pratham 0 Reputation points
2025-01-11T15:27:12.7233333+00:00

I have Implement customization in map. In which I have created cluster of pin and when click on pin a custom Info Window need to be open. After spending couple of hours I found that the issue is that need to set InfoWindowAdapter in clustermanager. But the clustermanager doesn't contain "MarkerCollection" which is available in Xamarin but not in maui.

clustermanager.MarkerCollection.SetOnInfoWindowAdapter(infoWindow);

In below code

public voidpublic void OnMapReady(GoogleMap googleMap)
            {
                clustermanager = new ClusterManager(Platform.CurrentActivity, googleMap);
                googleMap.SetOnCameraIdleListener(clustermanager);
                googleMap.SetOnMarkerClickListener(clustermanager);
                var cuslterrenderer = new ClusterRenderer(Platform.CurrentActivity, googleMap, clustermanager)
                {
                    MinClusterSize = 4,
                };
                clustermanager.Renderer = cuslterrenderer;
                // clustermanager.MarkerCollection.SetOnInfoWindowAdapter(infoWindow);
                googleMap.SetInfoWindowAdapter(clustermanager.MarkerManager);
                googleMap.SetOnInfoWindowClickListener(clustermanager);
                _handler._clusterManager.SetOnClusterItemInfoWindowClickListener(infoWindowClickListener);
                if (pins.Count > 0)
                {
                    clustermanager.AddItems(pins);
                }
            }

Maui handler should contain all the native methods which was available in Xamarin.

Is any alternative to fix this? I refer this url but didn't found any help https://github.com/googlemaps/android-maps-utils/issues/738

ClusterManager is coming from <PackageReference Include="GoogleMapsUtils.Android.Maui" Version="1.0.2">

MAUI version is 8.0.100
Android Platform API level is 34

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,807 questions
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 46,826 Reputation points Microsoft Vendor
    2025-01-13T06:37:52.49+00:00

    Hello,

    Thanks for your feedback.

    I checked the ClusterManager class in GoogleMapsUtils.Android.Maui, and found that the MarkerCollection property does not exist in the class.

    Since Microsoft Q&A does not provide technical support for third-party plug-ins, it is recommended that you report this issue to the official repository of this plug-in.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Pratham 0 Reputation points
    2025-01-13T08:27:29.9+00:00

    I think instead of GoogleMapsUtils.Android.Maui use Xamarin.Google.Maps.Utils

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.