Module plugin-googlemaps

Overview

This plugin provides support for Google Maps by utilizing the Google Maps Android SDK.

Getting Started

Set up the development environment

  1. Android Studio is required. If you haven’t already done so, download and install it.
  2. Ensure that you are using the Android Gradle plugin version 7.0 or later in Android Studio.

Set up your Google Cloud project for applications with Google Services (Google Maps)

Complete the required Cloud Console setup following the next steps, for more information see:

Set up the project

  1. Add the plugin to the project by following one of the guides:
  1. Configure API key according to the Official Documentation.

  2. In your app’s module-level AndroidManifest.xml add the required permissions, for more information see permissions.

    <manifest ...>
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
       <uses-permission android:name="android.permission.INTERNET" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
       <application ...>
          ...
       </application>
    </manifest>
    

Compatibility matrix

Legend of support levels:

Support level Symbol
Fully supported βœ…
Partially supported 🟨
Not supported ❌

Map

OmhMap

Method Support level
addMarker βœ…
addPolyline βœ…
addPolygon βœ…
getCameraPositionCoordinate βœ…
moveCamera βœ…
setZoomGesturesEnabled βœ…
setMyLocationEnabled βœ…
isMyLocationEnabled βœ…
setMyLocationButtonClickListener βœ…
setOnCameraMoveStartedListener βœ…
setOnCameraIdleListener βœ…
setOnMapLoadedCallback βœ…
setOnMarkerClickListener 🟨
setOnMarkerDragListener βœ…
setOnInfoWindowOpenStatusChangeListener 🟨
setOnInfoWindowClickListener βœ…
setOnInfoWindowLongClickListener βœ…
setOnPolylineClickListener βœ…
setOnPolygonClickListener βœ…
snapshot βœ…
setMapStyle βœ…
setCustomInfoWindowContentsViewFactory βœ…
setCustomInfoWindowViewFactory βœ…

Comments for partially supported 🟨 properties:

Property Comments
setOnInfoWindowOpenStatusChangeListener (1) only the onInfoWindowClose event is supported
(2) the listener is invoked before OmhOnMarkerClickListener, in contrast to other providers, which implies that if the window was already open before a click on the marker, the marker click listener would always be invoked after the window is closed
setOnMarkerClickListener (1) the default behaviour of the on click listener (or when a custom handler returns false) is to center the map on the clicked marker
(2) there is a non-overrideable behaviour of the Google Maps plugin, which hides (closes) an open info window when the map is tapped elsewhere

Marker

OmhMarkerOptions

Property Support level
position βœ…
title βœ…
draggable βœ…
anchor βœ…
infoWindowAnchor βœ…
alpha βœ…
snippet βœ…
isVisible βœ…
isFlat βœ…
rotation βœ…
backgroundColor 🟨
clickable βœ…
zIndex βœ…

Comments for partially supported 🟨 properties:

Property Comments
backgroundColor hue (H) component of HSV color representation is controllable
alpha channel is unsupported

OmhMarker

Method Support level
getPosition βœ…
setPosition βœ…
getTitle βœ…
setTitle βœ…
getClickable βœ…
setClickable βœ…
getDraggable βœ…
setDraggable βœ…
setAnchor βœ…
setInfoWindowAnchor 🟨
getAlpha βœ…
setAlpha βœ…
getSnippet βœ…
setSnippet βœ…
setIcon βœ…
getIsVisible βœ…
setIsVisible βœ…
getIsFlat βœ…
setIsFlat βœ…
getRotation βœ…
setRotation βœ…
getBackgroundColor ❌
setBackgroundColor 🟨
showInfoWindow βœ…
hideInfoWindow βœ…
getIsInfoWindowShown 🟨
remove βœ…
getZIndex βœ…
setZIndex βœ…

Comments for partially supported 🟨 properties:

Property Comments
setInfoWindowAnchor as per this issue, sometimes the info window is anchored to the marker’s lat/lng instead of the set anchor - the issue is still open
setBackgroundColor only hue (H) component of HSV color representation is controllable, alpha channel is unsupported
getIsInfoWindowShown calling getIsInfoWindowShown() from on click handler will always return false as per this wontfix GoogleMaps issue

Polyline

OmhPolylineOptions

Property Support level
points βœ…
clickable βœ…
color βœ…
width βœ…
isVisible βœ…
zIndex βœ…
jointType βœ…
pattern βœ…
cap βœ…
startCap βœ…
endCap βœ…
spans βœ…

OmhPolyline

Method Support level
getCap ❌
setCap βœ…
isClickable βœ…
setClickable βœ…
getColor βœ…
setColor βœ…
getEndCap ❌
setEndCap βœ…
getJoinType βœ…
setJoinType βœ…
getPattern βœ…
setPattern βœ…
getPoints βœ…
setPoints βœ…
getSpans ❌
setSpans βœ…
getStartCap ❌
setStartCap βœ…
getTag βœ…
setTag βœ…
getWidth βœ…
setWidth βœ…
getZIndex βœ…
setZIndex βœ…
isVisible βœ…
setVisible βœ…
remove βœ…

Polygon

OmhPolygonOptions

Property Support level
outline βœ…
clickable βœ…
fillColor βœ…
holes βœ…
isVisible βœ…
strokeColor βœ…
strokeJointType βœ…
strokePattern βœ…
strokeWidth βœ…
zIndex βœ…

OmhPolygon

Method Support level
getClickable βœ…
setClickable βœ…
getStrokeColor βœ…
setStrokeColor βœ…
getFillColor βœ…
setFillColor βœ…
getStrokeJointType βœ…
setStrokeJointType βœ…
getStrokePattern βœ…
setStrokePattern βœ…
getOutline βœ…
setOutline βœ…
getHoles βœ…
setHoles βœ…
getTag βœ…
setTag βœ…
getStrokeWidth βœ…
setStrokeWidth βœ…
getZIndex βœ…
setZIndex βœ…
isVisible βœ…
setVisible βœ…
remove βœ…

Documentation

Contributing

Please contribute! We will gladly review any pull requests. Make sure to read the Contributing page first though.

License

Copyright 2023 Open Mobile Hub

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.