public override void OnResume() { base.OnResume(); GMap = FragmentManager.FindFragmentById<GMapFragment>(Resource.Id.gmap8485315486415); GPlaces = new GPlacesHandler(); // registers to map events for adding the places GMap.mapReadyCallback.MapReady += (sender, args) => { var map = ((GMapHandler)sender).Map; map.CameraChange += async (s, a) => { var jsonval = await GPlaces.GetPlacesAsJSON(map.CameraPosition.Target.Latitude, map.CameraPosition.Target.Longitude, map.Projection.VisibleRegion.LatLngBounds); var gyms = Gym.InstatiateManyFromGeoJson(jsonval); if (gyms != null) foreach(var gym in gyms) { Log.Debug("JSON", "" + gym); map.AddMarker(new MarkerOptions().SetPosition(new LatLng(gym.lat, gym.lng)).SetTitle(gym.name)); } }; }; }
public override void OnResume() { base.OnResume(); GMap = FragmentManager.FindFragmentById <GMapFragment>(Resource.Id.gmap8485315486415); GPlaces = new GPlacesHandler(); // registers to map events for adding the places GMap.mapReadyCallback.MapReady += (sender, args) => { var map = ((GMapHandler)sender).Map; map.CameraChange += async(s, a) => { var jsonval = await GPlaces.GetPlacesAsJSON(map.CameraPosition.Target.Latitude, map.CameraPosition.Target.Longitude, map.Projection.VisibleRegion.LatLngBounds); var gyms = Gym.InstatiateManyFromGeoJson(jsonval); if (gyms != null) { foreach (var gym in gyms) { Log.Debug("JSON", "" + gym); map.AddMarker(new MarkerOptions().SetPosition(new LatLng(gym.lat, gym.lng)).SetTitle(gym.name)); } } }; }; }