Select to view content in your preferred language

Runtime 200.2.0: Android Maui Map Not Loading?

607
2
Jump to solution
11-07-2023 01:51 PM
Labels (2)
ShaneRumbaugh
New Contributor II

Hello Im in the process of porting my xamarin app over to MAUI. The credentials im using are the same in both the Maui project and the Xamarin project.  I have no issues with anything map related in the xamarin project. I have not tested anything on the iOS side yet. 

I do not have an API key set. I didnt need one for the xamarin project so im also assuming i do not need one for the Maui Project. 

In my Maui projected however im experinecing issues with the Map not loading.

My map is within a Grid that has "Auto" columns.  I saw a couple other posts where it was speculated this was a layout issue with MAUI. Have all the bugs been fixed surrounding this area?

Additionally despite having entered in the proper credentials in the "MauiApp.CreateBuilder" it will prompt me to enter in my credentials. 

"Credentails Required"

"basemaps-api.arcgis.com"

Now im not targeting any kind of online basemaps just these... I never had any issues in xamarin has anything changed within the Maui version? 
_basemapOptions = new Dictionary<string, Basemap>()
{
{"Street", new Basemap(BasemapStyle.ArcGISStreets) },
{"Imagery", new Basemap(BasemapStyle.ArcGISImagery) },
{"Imagery With Labels", new Basemap(BasemapStyle.ArcGISImageryLabels) },
{"Oceans", new Basemap(BasemapStyle.ArcGISOceans) },
{"Open Street Map", new Basemap(BasemapStyle.OSMStandard) },
{"Streets With Relief Vector", new Basemap(BasemapStyle.ArcGISStreetsReliefBase) },
{"Create Terrain With Labels", new Basemap(BasemapStyle.ArcGISTerrainDetail) },
{"Topographic", new Basemap(BasemapStyle.ArcGISTopographic) },
{"Light Gray Canvas (Raster)", new Basemap(BasemapStyle.ArcGISLightGray)},
};

--- Code for the Map
Edit here I do have this Grid Wrapped within a RelativeLayout. The code has been Updated to reflect this. 

<compatibility:RelativeLayout>

     <Grid>

          <Grid
           Grid.Row="0"
          Grid.RowSpan="1"
         Style="{StaticResource BaseGridStyle}">
         <Grid.RowDefinitions>
                 <RowDefinition Height="35" />
                <RowDefinition Height="55" />
                 <RowDefinition Height="*" />
                 <RowDefinition Height="2*" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="5" />
                 <ColumnDefinition Width="Auto" />
                 <ColumnDefinition Width="*" />
                 <ColumnDefinition Width="Auto" />
                 <ColumnDefinition Width="5" />
         </Grid.ColumnDefinitions>

          <esri:MapView
          x:Name="SiteMapView"
          Grid.Row="1"
          Grid.RowSpan="4"
          Grid.Column="0"
          Grid.ColumnSpan="5"
          x:FieldModifier="public"
          BackgroundColor="White"
          GeoViewTapped="EsriMap_GeoViewTapped"
          GraphicsOverlays="{Binding GraphicsOverlays}"
          Map="{Binding Map}"
          ViewpointChanged="EsriMap_ViewpointChanged" />

           ......

          </Grid>

     </Grid>

</compatibility:RelativeLayout>

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

I do not have an API key set

If you're using the basemap styles from ArcGIS Online you need to set an API Key (judging from your code you are).

100.x still had access to the old services but you should have been getting obsolete warnings for a few releases if you were still using those. In 200 those have been removed.

If a map doesn't load, look at the output window for clues.
Also good to try an explicit load of the map using "await map.LoadAsync()" which should throw an error if there's an issue.

View solution in original post

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

I do not have an API key set

If you're using the basemap styles from ArcGIS Online you need to set an API Key (judging from your code you are).

100.x still had access to the old services but you should have been getting obsolete warnings for a few releases if you were still using those. In 200 those have been removed.

If a map doesn't load, look at the output window for clues.
Also good to try an explicit load of the map using "await map.LoadAsync()" which should throw an error if there's an issue.

0 Kudos
ShaneRumbaugh
New Contributor II

Thanks for the quick reply! Ill try adding that API key in to see if it takes care of most of my problems!

Update: Adding in the API key fixed all the issues thanks again!

0 Kudos