GeoBlazor, like Blazor, pretty much “just works” with the Blazor Hybrid MAUI templates, allowing you to deploy your application to Android, iOS, Mac, and Windows as packages stored or installable apps. Below are a few key points to keep in mind when using GeoBlazor with MAUI.
By default, MAUI does not use the same
IConfiguration settings as Blazor and Asp.NET Core. But you can easily add support for this feature with the following code (also available in our
dymaptic.GeoBlazor.Samples.MAUI sample application).
builder.Services.AddGeoBlazor(); var executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly .GetManifestResourceStream("YOUR.PROJECT.NAMESPACE.appsettings.json")!; IConfigurationRoot config = new ConfigurationBuilder() .AddUserSecrets(executingAssembly) .AddJsonStream(stream) .Build(); builder.Configuration.AddConfiguration(config);
- Create the file
appsettings.jsonin the root of your MAUI project, and add the
ArcGISApiKeyas described in Getting Started.
- Alternatively, you can also create a
secrets.jsonafter adding the above code.
The current Android Emulator on Windows does not have OpenGL/WebGL support turned on by default. Since ArcGIS uses WebGL, you will need to enable this feature, or you will get an error on the first map render.
- Use your IDE’s link to the Android Virtual Device (AVD) Manager to open the AVD Manager.
- Create a new virtual device with the latest Android api version.
Open a command prompt or terminal, and run the following command to list the available AVDs.
"C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" -list-avds
Find your new virtual device from the list, then run the following command to launch this device with OpenGL/WebGL support enabled.
"C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" -avd "YOUR_DEVICE_NAME" -feature GLESDynamicVersion
- Once the emulator is running, you may launch and debug your application from the IDE as normal.