Fix: colored icon does not work on Android
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.0-beta-20180430-1711" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.3.0-beta-20180430-1841" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
src/android/plugin/google/maps/PluginMarker.java
src/android/plugin/google/maps/PluginMarker.java
@@ -313,7 +313,6 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
final JSONObject result = new JSONObject();
result.put("id", markerId);
-
// Load icon
if (opts.has("icon")) {
//------------------------------
@@ -323,6 +322,15 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
Object value = opts.get("icon");
if (JSONObject.class.isInstance(value)) {
JSONObject iconProperty = (JSONObject) value;
+ if (JSONArray.class.isInstance(iconProperty.get("url"))) {
+
+ float[] hsv = new float[3];
+ JSONArray arrayRGBA = iconProperty.getJSONArray("url");
+ Color.RGBToHSV(arrayRGBA.getInt(0), arrayRGBA.getInt(1), arrayRGBA.getInt(2), hsv);
+ bundle = new Bundle();
+ bundle.putFloat("iconHue", hsv[0]);
+
+ } else {
if (iconProperty.has("label")) {
JSONObject label = iconProperty.getJSONObject("label");
if (label != null && label.get("color") instanceof JSONArray) {
@@ -367,6 +375,7 @@ public class PluginMarker extends MyPlugin implements MyPluginInterface {
bundle.putDoubleArray("infoWindowAnchor", anchorPoints);
}
}
+ }
} else if (JSONArray.class.isInstance(value)) {
float[] hsv = new float[3];

Fix: colored icon does not work on Android #2246