Repository navigation
Map Sheet Fragment Android
In Android SDK 9.0, a beta version of the MapSheetFragment was added. This fragment extends the existing MapFragment by adding a bottom sheet that provides search capabilities along with details about map features. This takes the functionality of the Map tab in the Meridian editor and makes it easy to embed into an application.
The steps to get MapSheetFragment working are:
In the build.gradle file inside dependencies { }, insert implementation and annotationProccessor for the Glide and GreenRobot libraries. This library is used for displaying placemark images and map icon images. Please see the MeridianSamples build.gradle file for the current version.
implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
implementation 'org.greenrobot:eventbus:3.2.0'
To use Glide within the Meridian SDK, an AppGlideModule needs to be added to the main application. An example of this is the SamplesGlideModule in MeridianSamples.
@GlideModule
public class SamplesGlideModule extends AppGlideModule {
public boolean isManifestParsingEnabled() { return false;}
}
To enable the search features in the MapSheetFragment, it is necessary to enable search in your project’s AndroidManifest.xml file. See MeridianSamples for an example. Place the following code in the Activity section of the activity that hosts MapSheetFragment:
<!-- Required for search when using MapSheetFragment -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<!-- Required for search when using MapSheetFragment -->
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
To create an instance of MapSheetFragment, use MapSheetFragment.Builder
MapSheetFragment.Builder mapSheetBuilder = new MapSheetFragment.Builder()
.setMapKey(MAP_KEY).showFriends(true);
fragment = mapSheetBuilder.build();
MapSheetEventListener
The MapSheetEventListener contains the OnSheetLoaded event. It is important that the MapSheetFragment is not dismissed before the OnSheetLoaded event fires. The listener also has the onCallPermissionRequested event which is called when the user needs call permission.
-
The MapSheetFragment can crash if the MapSheetFragment is dismissed before the bottom sheet is loaded. Wait until the OnSheetLoaded event has fired.
-
Fixed in 9.1.0 with onCallPermissionRequested. Android CALL_PHONE Permission - If a placemark has an associated phone number, the placemark details bottom sheet offers the user a call button. To make this work, the Android runtime CALL_PHONE permission must be granted before the button is pressed.
-
Build error: mr_map_sheet.xml:30: AAPT: error: attribute behavior_hideable (aka com.arubanetworks.meridiansamples:behavior_hideable) not found. Add the following line to your applications's
build.gradlefile.implementation 'com.google.android.material:material:1.7.0'
-
Build error: java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found. Add the following line to your applications's
build.gradlefile.implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'