Xamarin.Forms.GoogleMaps icon indicating copy to clipboard operation
Xamarin.Forms.GoogleMaps copied to clipboard

AnimationStatus.Finished on a MoveCamera != map rendered

Open chrisfoulds opened this issue 7 years ago • 6 comments

VERSIONS

  • Xamarin.Forms.GoogleMaps - 3.0.4
  • Xamarin.Forms - 3.3.0.912540

PLATFORMS

  • [x] Android
  • [ ] iOS
  • [ ] UWP

ACTUAL BEHAVIOR

I am trying to automatically save a snapshot after adding points and moving to the bounds.

var bounds = Xamarin.Forms.GoogleMaps.Bounds.FromPositions(map.Polylines.SelectMany(poly => poly.Positions));
var newBoundsArea = CameraUpdateFactory.NewBounds(bounds, 5);
await map.MoveCamera(newBoundsArea);
var stream = await map.TakeSnapshot();

However when I take the snapshot the camera has not moved nor has the map being rendered again. How do I wait for the actual render to be complete before saving the snapshot ?

chrisfoulds avatar Oct 22 '18 15:10 chrisfoulds

Yes, await map.MoveCamera/AnimateCamera NOT means move map finished. You can observe when move map finished using Map.CameraIdled event.

But maybe it NOT means render map completed. I'm not sure to how to observe render map finished in Google Maps SDK.

amay077 avatar Mar 19 '19 14:03 amay077

Thanks, i've not found a way currently. I am waiting on the camera idled now but as you say it is not enough.

chrisfoulds avatar Mar 19 '19 15:03 chrisfoulds

I think you should delay any seconds (await Task.Delay(3000ms)) .

amay077 avatar Mar 23 '19 06:03 amay077

How is this closed ? There is still no reliable method

chrisfoulds avatar Jan 14 '20 17:01 chrisfoulds

Sorry, but I have no idea to resolve your issue.

amay077 avatar Jan 15 '20 00:01 amay077

Wouldn't using and exposing this work ? https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap.OnMapLoadedCallback

chrisfoulds avatar Jan 15 '20 05:01 chrisfoulds