Flightmap SDK leverages the power of opensource MBGL sdk to render our custom map dataset.Our SDK supports current version :
v22.214.171.124 and the following features:
Before starting to develop your application with the Flightmap SDK, you'll need to add the SDK as a dependency. You can find the following dependency given below in the MavenCentral repository. If your application is close or exceeds the 65k method count limit, you can mitigate this problem by enabling ProGuard inside your application. ProGuard directives are included in the Android dependencies to preserve the required classes. You can also shrink the file APK file size by making use of APK splitting.
Start Android Studio
Android Project should be in Android X
Android Studio 3.+
Open up your application's build.gradle file.
Make sure that your project's minSdkVersion is at API 14 or higher.
Under dependencies, add a new implementation dependency line for the latest flightmap-android-sdk.
Find the File in the toolbar and then click on Sync Project with Gradle Files.
Note:Add the following dependency to your app module’s build.gradle file project/app/build.gradle:
Note:Add Maven in project build.gradle file in all project repository
Additionally, running gradle app_module_name_here:dependencies in your command line will print a list of dependencies. ./gradlew app:dependencies works if you have a Gradle wrapper. They are helpful for troubleshooting nimble Gradle configurations when various libraries are included in a single project. You can see the dependencies that specific libraries are bringing and where conflicts might be happening.
Copy your default public token to your clipboard. After you've added the Maps SDK as a dependency inside of your Android project, open the R.strings.xml file, create a new String resource, and paste the access token.
Then to pass this into the Flightmap SDK, you'll want to place the access token inside of your application's onCreate() method.
The Flightmap SDK also provides a setToken() method in case you want to switch the Flightmap access token at runtime.
Starting with the 5.0 version of the Maps SDK, you can use the Manifest merge feature to reduce the need to include any Maps SDK required things inside of your application's manifest file. You'll need to add either the Fine or Coarse location permission if you plan to display a user's location on the map or get the user's location information. The user location permission should also be checked during runtime using the PermissionsManager.
Open the Java file of the activity where you'd like to include the map in and add the code below to the file.
Open the activity's XML layout file and add the mapView within your layout.
The MapView contains its own lifecycle methods for managing Android's OpenGL lifecycle, which must be called directly from the containing Activity. In order for your app to correctly call the MapView's lifecycle methods, you must override the following lifecycle methods in the Activity that contains the MapView and call the respective MapView method. For example, your onStart() method should look like this:
Like the onStart() override above, the following lifecycle methods also need to be overridden and include the matching MapView method:
If you're using a fragment, call mapview.onDestroy() inside the fragment's onDestroyView() method rather than inside onDestroy():
Markers are useful when identifying a single point on the map. The SDK comes with a default marker icon which can be configured to fit your specific needs. APIs are exposed to optionally change this icon to any bitmap image you wish. To create a marker for you map, you are only required to provide a LatLng position which defines where the marker will be placed on the map. Call mapboxMap.addMarker() to add the marker to the map.
Add a list of markers using mapboxMap.addMarkers() if you have many markers or are loading them from a GeoJSON file.
The Flightmsp Android SDK comes with two methods for removing markers. If you'd like to remove a particular marker, use mapboxMap.removeMarker() while passing in the marker object to be removed. If you would like to remove all markers, call the mapboxMap.clear() method. Note that this will also remove any polylines and polygons you’ve added to your map.
You can specify a custom icon by using the IconFactory object and passing it to the marker. The default marker icon's used if you don’t specify an icon while creating your marker. The anchoring of the marker will be in the center, meaning if you have an icon with a point, you'll need to add padding to the bottom of the image.
Adding a line or polygon to your map is like adding a marker. Due to the nature of these objects, different APIs are exposed, such as polygon color or line width. Instead of taking in a single position, bundle all your LatLng objects inside of a List and then pass them in using the addAll() method.