amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
545 stars 346 forks source link

[NEED FEEDBACK]Version 4.0.0-BETA1 Published #729

Open amay077 opened 3 years ago

amay077 commented 3 years ago

I published Xamarin.Forms.GoogleMaps ver 4.0.0-BETA1 to nuget.

https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/4.0.0-BETA1

This version depends latest SDK for Android and iOS. Also does not support .NET Standard 1.0(only .NET Standard 2.0).

Android

iOS

Please try in your apps and give me feedback!

themronion commented 3 years ago

Hooray!!!!

codercampos commented 3 years ago

Let me try something today.

jBijsterboschNL commented 3 years ago

It definitely fixed the GooglePlayServices version mismatch (we are also using OneSignal and GooglePlayServices.Auth). We will thoroughly test the GoogleMaps control in the next weeks and let you know our findings (if any). Cheers

themronion commented 3 years ago

I haven't found issues with my app. The only thing is that UWP is now unsupported, but u warned about this, no problem - just used the old version for uwp. Nice job! Though i have a question, are the icons for android now being loaded from resources? @amay077

StryderJermaine commented 3 years ago

App crashes when launching map on iOS.

System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.Forms.GoogleMaps.iOS.MapRenderer.UpdateIsShowingUser (System.Nullable`1[T] initialMyLocationButtonEnabled)

themronion commented 3 years ago

@StryderJermaine did u ask the location permission before showing the user?

StryderJermaine commented 3 years ago

@StryderJermaine did u ask the location permission before showing the user?

@themronion Yes. I have this in the info.plist.

NSLocationWhenInUseUsageDescription NSLocationAlwaysUsageDescription NSLocationAlwaysAndWhenInUseUsageDescription

themronion commented 3 years ago

@StryderJermaine its not enough. U should prompt a user whether he agrees to share the location. Permissions, xamarin essentials

StryderJermaine commented 3 years ago

@themronion I don't think that's the problem because when I use Xamarin.Forms.Maps, it works without location permissions.

themronion commented 3 years ago

@StryderJermaine Still, try it, because here showing the location may be enabled by default

StryderJermaine commented 3 years ago

@themronion Alright. I've added location permissions. Still throwing the same error.

StryderJermaine commented 3 years ago

App crashes when launching map on iOS.

System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.Forms.GoogleMaps.iOS.MapRenderer.UpdateIsShowingUser (System.Nullable`1[T] initialMyLocationButtonEnabled)

@amay077 Can you help with this?

themronion commented 3 years ago

@StryderJermaine i've updated my vs 2019 version (and the xamarin.ios version as too i guess) and started to receive this error as well. Which versions are u using? Might be worth to take a look @amay077

KirstyLH commented 3 years ago

I'm getting the same "Object reference not set to an instance of an object." error and haven't been able to find a solution for it. Have tried every suggestion in terms of nuget package versions that I could find, nothing seems to change that it crashes on attempting to load the map. Any help with this would be appreciated.

themronion commented 3 years ago

@felipechavez which version of xamarin.ios and visual studio are u using? I've upgraded to the latest and started to get that error. Maybe it has to do something with that

themronion commented 3 years ago

I'm getting the same "Object reference not set to an instance of an object." error and haven't been able to find a solution for it. Have tried every suggestion in terms of nuget package versions that I could find, nothing seems to change that it crashes on attempting to load the map. Any help with this would be appreciated.

And u too, can u confirm that this happens on the latest versions of vs/xamarin.ios?

themronion commented 3 years ago

@amay077 https://github.com/amay077/Xamarin.Forms.GoogleMaps/blob/24d39cafb83afd1786d90f5c43d99743dd6de18f/Xamarin.Forms.GoogleMaps/Xamarin.Forms.GoogleMaps.iOS/MapRenderer.cs#L325 i suppose the problem is somewhere here

felipechavez commented 3 years ago

Hi @themronion , i have:

Visual Studio Community 2019 for Mac Version 8.7.4 (build 38)

Xamarin.iOS Version: 13.20.2.2 (Visual Studio Community) Build date: 2020-07-18 18:45:00-0400

The problem is that probably, the Xamarin.iOS version. The latest is 13.99

themronion commented 3 years ago

@felipechavez i think so as well

themronion commented 3 years ago

But @amay077 is not answering as usual so there is nothing we can do about it)

KirstyLH commented 3 years ago

@felipechavez - thanks, but I followed all the instructions in terms of setting up the Google api keys. They are not the problem.

I have the maps working for both Android and UWP - I am trying to now incorporate an ios project into an existing solution. I have been searching for a workaround for days. It appears to be tied to the build on Visual Studio for Windows (without a Mac build environment) feature of the latest version of Visual Studio 2019. Here is the platform I am using:

Visual Studio Enterprise 2019 Version 16.7.2 which has built in Xamarin.iOS 13.20.2.2

I don't want to link to our build Mac most of the time as I am working remotely and don't necessarily have physical access to it all the time, so I've been using the windows local build to test. I have tried every combination of xamarin.forms and xamarin.forms.googlemaps I can think of - removed nuget caches, cleared the obj and bin folders, rebuilt, restarted visual studio, uninstalled the app from the device - the error never changes and the app crashes out on any page a map is trying to render.

themronion commented 3 years ago

@KirstyLH i think we figured out the problem. It is the problem with hotreload. Since i tried with it as well. Also hotreload haven't managed to start up my firebase services. So i think now it can't work properly with google services. @StryderJermaine were u using hotreload?

themronion commented 3 years ago

The last time i tried with the mac build host everything was ok. Maybe we should write to Microsoft about this?

dalton5 commented 3 years ago

Hi,

I tested the map with Androidx and I have an error I did not have before.

'Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view. Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions.'

Do you know what could be the cause? It occurs when I use wait MapValue.AnimateCamera(newBoundsArea, TimeSpan.FromSeconds(3)); in the OnAppearing event of my page.

In Android not x I did not have the issue.

themronion commented 3 years ago

@dalton5 I had this error before. The error states in details what is wrong: "Most likely, layout has not yet occured for the map view." This means that you are trying to call the method when the map hasn't been rendered yet. Just try to call the method a little bit later

StryderJermaine commented 3 years ago

@KirstyLH i think we figured out the problem. It is the problem with hotreload. Since i tried with it as well. Also hotreload haven't managed to start up my firebase services. So i think now it can't work properly with google services. @StryderJermaine were u using hotreload?

HotRestart (for iOS). After disabling HotRestart and connecting to a mac host, the issue was resolved

felipechavez commented 3 years ago

anyone else having trouble uploading the app to the AppStore? I found the following link in a quick search, and this one that has a solution in the last answer

I had to downgrade back to 3.3.0 on ios due to #728

kgouraw commented 3 years ago

I have updated my project to Xamarin Forms 4.7.x, and also migrated Android project to AndroidX support library. This version 4.0.0-BETA1 works fine for me on both platforms iOS and Android. Thanks @amay077, when are you releasing it as a stable release version? Can you go to the App/Play Store with the current BETA version?

jBijsterboschNL commented 3 years ago

@amay077, we are using this beta version as well. Didn't ran into any issues so far. We are using Pins, Polygons, custom Info Window and probably some more features...

Something else: could you release a new NuGet version to release the change that the Pin class is no longer sealed? This is a change we would want at the moment and we've noticed that the code fix was already in place, but not yet released in a new NuGet package.

simonemarra commented 3 years ago

I'm starting a brand new project using AndroidX out of the box. Actually on Android it seems to work correctly but I need some more time to check all the features I will use!

gsgou commented 3 years ago

@amay077 in iOS 14 with Xamarin.iOS 14.0.0.0 the currentLocationMarker is not showing the default blue dot icon.

Screenshot 2020-10-11 at 15 39 08
sarthak1995-26 commented 3 years ago

Polyline not showing on Android.On iOS it's showing fine.Do we need to install any Any Android.Support libraries

themronion commented 3 years ago

@sarthak1995-26 More info pls. A 100% the issue is in ur code. Show us how you make a polyline and display it

sarthak1995-26 commented 3 years ago

If there was something wrong in code polyline should not be shown on iOS.But yes I have not installed any android support library since I am using AndroidX.

Tested on Android 10 Xamarin Version : Latest Stable

sarthak1995-26 commented 3 years ago

This is the code I am using

map.Polylines.Clear();
var polyline = new Polyline();
var positions = (Enumerable.ToList(PolylineHelper.Decode(rslt.Data.routes.First().overview_polyline.points)));
 foreach (var p in positions)
{
   polyline.Positions.Add(p);
}
polyline.IsClickable = false;
polyline.StrokeColor = Color.FromHex("#f0b85c");
polyline.StrokeWidth = 5f;
polyline.Tag = "POLYLINE";
map.Polylines.Add(polyline);
sarthak1995-26 commented 3 years ago

I am getting overview_polyline.points from Google direction api. This same code creates polyline on iOS but shows nothing on android There maybe more then 300 hundred position in a polyline I am showing. that might be causing issue not sure though

sarthak1995-26 commented 3 years ago

@themronion are you able to replicate it or do you need something else from me let me know 👍 .

themronion commented 3 years ago

@sarthak1995-26 dunno man, maybe try commenting out the polyline.Tag and the polyline.StrokeWidth line to see if the problem is there. You can also try commenting out the polyline.IsClickable line

sarthak1995-26 commented 3 years ago

I think problem is with StrokeColor or StrokeWidth property I tried a polygon too.It does show a fill color but doesn't render's the stroke on boundary.Though on iOS it does show stroke

themronion commented 3 years ago

@sarthak1995-26 try strokewidth = 5 instead of 5f

Sarthak261995 commented 3 years ago

tried but didn't worked :( @themronion thank you for your help mate will try something else or something should be wrong with my app since other people commented on this thread did not encountered this problem.

PaoloLeva commented 3 years ago

I get this exception on Android, the same code works fine on iOS

InnerException {System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.Forms.GoogleMaps.Android.MapRenderer..ctor (Android.Content.Context context) [0x0005e] in <9a1405b985b545d8996707dd11469b82>:0 at (wrapper managed-to-native) S…} System.NullReferenceException

In my app I do not need to show the user position so I do not request the access to the GPS. I also tried removing all controls to the map, just invoking a plain Map in the XAML, but it still breaks on that exception. I am using Xamarin.Forms 5.0.0.1931

sermetk commented 3 years ago

Polyline not showing on Android.On iOS it's showing fine.Do we need to install any Any Android.Support libraries

Have you tried to use outside the scrollview?

spinitwide commented 3 years ago

Have you tried to use outside the scrollview?

OMG, this solved the polyline issue for me. Why oh why does this not work on Android within a scrollview, does anyone know? All good in iOS.

AlonRom commented 2 years ago

@amay077 You have an estimate of when this version will be released as stable?

PaoloLeva commented 2 years ago

@AlonRom it seems that this project is abandoned. Unfortunately because it was by far the best implementation of google maps for Xamarin. Let's hope someone else with enough skills will revive it