Map Sheet Fragment (Android) Beta Follow
In Android SDK 9.0, a beta version of the MapSheetFragment has been 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 Aruba Meridian and makes it easy to embed into an application.
The steps to get MapSheetFragment working are:
Add Dependencies
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'
Add an AppGlideModule
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;}
}
Enable search in application manifest
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" />
Build MapSheetFragment
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.
Known Issues
1. The MapSheetFragment can crash if the MapSheetFragment is dismissed before the bottom sheet is loaded. Wait until the OnSheetLoaded event has fired.
2. 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.
3. 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.gradle
file.
implementation 'com.google.android.material:material:1.7.0'
4. Build error: java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found. Add the following line to your applications's build.gradle
file.
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
Comments
0 comments
Article is closed for comments.