App loading blank when referring the map display sample

167
1
12-09-2021 12:09 AM
BrentSlone3
New Contributor III

Hi team we are referring this simple map display sample: 

https://developers.arcgis.com/net/forms/sample-code/display-map/

We created a blank solution and added the following code:

MainPage.xaml ==Start==

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esri="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"

x:Class="LicenseIssue.MainPage">

<StackLayout>
<Grid>
<esri:MapView x:Name="GMyMapView"/>
</Grid>
</StackLayout>

</ContentPage>

 

MainPage.xaml ==End==

 

MainPage.xaml.cs ==Start==

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Esri.ArcGISRuntime.Mapping;
using Xamarin.Forms;

namespace LicenseIssue
{
public partial class MainPage : ContentPage
{
public MainPage()
{
var a = new Esri.ArcGISRuntime.Xamarin.Forms.MapView();
//InitializeComponent();
InitializeComponent();
// Create the UI, setup the control references and execute initialization
Initialize();
}

private void Initialize()
{


// Create new Map with basemap
Map myMap = new Map(BasemapStyle.ArcGISImageryStandard);

// Assign the map to the MapView
GMyMapView.Map = myMap;
}
}
}

MainPage.xaml.cs ==End==

Attached screenshot of the blank app loading

BrentSlone3_0-1639037349429.png

Any help would be appreciated

 

Tags (2)
0 Kudos
1 Reply
dotMorten_esri
Esri Frequent Contributor

Did you set the ApiKey? The basemap you're using requires that to be set.
https://developers.arcgis.com/documentation/mapping-apis-and-services/security/#api-keyshttps://deve...

Otherwise try Basemap.CreateImagery() which uses a non-metered service.

0 Kudos