コード例 #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;

            await locator.StartListeningAsync(TimeSpan.Zero, 100);

            var position = await locator.GetPositionAsync();

            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);

            var span = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            gameLocationsMap.MoveToRegion(span);

            var gameLocations = await GameLocation.Read();

            DisplayGameLocationsInMap(gameLocations);

            //  var gameLocations = await GameLocation.GetGameLocations(position.Latitude, position.Longitude);
        }