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
- Android Studio is required. If you havenβt already done so, download and install it.
- 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
- Add the plugin to the project by following one of the guides:
-
Configure API key according to the Official Documentation.
-
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.