Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Reference to type GoogleMap.IOnCameraMoveListener claims it is defined in Xamarin.GooglePlayServices

$
0
0

Hello everbody!

I'm facing an issue related with a reference, as the title shows I'm getting:

Reference to type 'GoogleMap.IOnCameraMoveListener' claims it is defined in 'Xamarin.GooglePlayServices.Maps', but it could not be found C:\Users\App.Xamarin\App.Android\CustomMapRenderer.cs

I been trying to use the live player on a Samsung Galaxy S8+ Android API 27 with no success.

`
using Android.Gms.Maps.Model;
using App.Android;
using App.Portable.Vista.ControlesUsuario.Mapas;
using System.Collections.Generic;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
using Xamarin.Forms.Maps.Android;

[assembly: ExportRenderer(typeof(MapaGoogle), typeof(CustomMapRenderer))]
namespace App.Android
{
public class CustomMapRenderer : MapRenderer
{
List routeCoordinates;
bool isDrawn;

    protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Map> e)
    {
        base.OnElementChanged(e);

        if (e.OldElement != null)
        {
            // Unsubscribe
        }

        if (e.NewElement != null)
        {
            var formsMap = (MapaGoogle)e.NewElement;
            routeCoordinates = formsMap.RouteCoordinates;
            Control.GetMapAsync(this);
        }
    }

    protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);

        if (e.PropertyName.Equals("VisibleRegion") && !isDrawn)
        {
            var polylineOptions = new PolylineOptions();
            polylineOptions.InvokeColor(0x66FF0000);

            foreach (var position in routeCoordinates)
            {
                polylineOptions.Add(new LatLng(position.Latitude, position.Longitude));
            }

            NativeMap.AddPolyline(polylineOptions);
            isDrawn = true;
        }
    }
}

}`

I spent 2 days already trying to figure out what's going on but it is quite hard to find a solution as the error is too specific if I am not mistaken.

Also, I do not know if it is related with the NuGet packages that require updates GooglePlayServices, Forms and so on. However, whenever I update them the references are missed in the whole solution.

Any help will be highly appreciated !

Cheers,

Eric R.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>