Getting started
Contents
With the Mobile Maps SDK, you can embed interactive, highly customizable maps into your Android mobile applications. Our maps are built on commercial vehicle-specific data from Trimble Maps, which allows you to plan and visualize safe, legal, and efficient routes for all types of vehicles, around the world. With features ranging from traffic data to weather alerts and road conditions, our Maps SDK is ideal for any application that demands maps for work.
To gain access to the SDK, please contact our Sales team for more information.
This guide is intended to get you on your way to incorporating Trimble’s mapping library into your mobile project. It covers the key concepts needed to install, display, and customize maps. You can also view sample projects and code in our public GitHub repository.
Installation
In order to use the Maps SDK, you will need to add it as a dependency to your project. The library can be accessed from a NuGet manager.
- Open your project in visual studio.
- clean the solution
- start building the project.
- After successful build, select the android emulator and press the start button. It will deploy the project on emulator.
https://trimblemaps.jfrog.io/artifactory/api/nuget/v3/maui/
- Browse and install the necessary library for TrimbleMaps SDK.
<PackageReference Include="TrimbleMaps.MapsSDK" Version="1.0.0" />
<PackageReference Include="TrimbleMaps.MapsSDK.Platform.Droid" Version="1.0.0" />
Permissions
You can use the Manifest merge feature to reduce the need to include any SDK requirements in your application’s manifest file. You’ll need to add either the Fine or Coarse location permission to your manifest if you plan to display a user’s location on the map or get the user’s location information, and the Background location permission to continue it while the app is in the background. The Permissions should be added in AndroidManifest.xml
under the manifests
folder.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Authentication
In order to use the APIs and SDK, you will need to authenticate your API key first. If you do not have an API key, you can request one. Authentication must be done prior to attempting to render a MapView
or using the APIs. An example can be found below:
// Authorize the API key for the session.
// apiKey requires your Trimble Maps API key
private void InitializeTrimbleMaps()
{
var apiKey = <Your-API-key-here>;
var accountInitOptions = AccountInitializationOptions.InvokeBuilder()
.Callback(_onAccountLoaded)
.Build();
var account = TrimbleMapsAccount.InvokeBuilder()
.ApiKey(apiKey)
.AddLicensedFeature(LicensedFeature.MapsSdk)
.Build();
TrimbleMapsAccountManager.Initialize(account, accountInitOptions);
}
Once authentication is complete, you can start to use the SDK.