Cordova-plugin-googlemaps: Can not load icon image file for Marker after external link opened

Created on 27 Sep 2018  路  13Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

I'm submitting a ... (check one with "x")

  • [ ] question
  • [ x ] any problem or bug report

OS: (check one with "x")

  • [ x ] Android
  • [ ] iOS
  • [ ] Browser

cordova information: (run $> cordova plugin list)

cordova-plugin-device 1.1.7 "Device"
cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

@ionic-native/core : "4.14.0" (also tested on 4.8.0)
@ionic-native/google-maps : "4.14.0" (also tested on 4.8.2)

Current behavior:
On Android, clicking a simple "a" link which takes the user out the of the app and into a web browser removes custom marker icons on the map. Marker images from a URL and Base64 marker images are not affected, only marker images from the local file path.

Expected behavior:
Clicking an "a" link anywhere in the app should not prevent the maps plugin from being able to use custom marker icons from a local filepath.

Screen capture or video record:

markerfilebug.m4v.zip

I made a modification of the ionic-googlemaps-quickdemo repo for testing:
https://github.com/chadevans/ionic-googlemaps-quickdemo/tree/android-link-bug-example

If you build from this repo/branch, you will need to add keys.

All I did was add an "a" link to the home page and a filepath icon to the marker on the HtmlInfoWindow page. Feel free to use this or just test in any app using this plugin.

bug fixed

Most helpful comment

Fixed. Please reinstall the plugin from the multiple_maps branch.
Thank you for reporting such a rare bug.

$> cordova plugin rm cordova-plugin-googlemaps

$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable ....

All 13 comments

Thank you for preparing, but attaching zip file is kind of spam.
Because I can't see it on mobile.
Please upload it to youtube.

Thank you for uploading the video. Umm, that's curiosity.

Agreed. It doesn鈥檛 happen on iOS.

Hi!
I have the same problem, I caught the log entries:

$聽adb -d logcat | grep png
09-27 21:31:43.516 15742 21408 W System.err: java.io.FileNotFoundException: www/img/icon/img/location-large.png
09-27 21:36:01.180 22851 25779 W System.err: java.io.FileNotFoundException: www/img/icon/img/woman-large.png
09-27 21:36:03.225 22851 25811 W System.err: java.io.FileNotFoundException: www/img/icon/img/ios-circle-filled-large.png

In all icons URLs I passed the path img/file_path_sample.png which is relative to my www folder. When the map is rendered and map.addMarker(options) is called, the path is changed on plugin. But if I restart the app, the same map is rendered as expect.

Thanks for your time!

Ok, I got the reason, this is a bug.

Fixed. Please reinstall the plugin from the multiple_maps branch.
Thank you for reporting such a rare bug.

$> cordova plugin rm cordova-plugin-googlemaps

$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable ....

@wf9a5m75 Thanks a lot, man!

Thank you for using this plugin.

Hi,

I have the same issue on iOS.

    const markerOptions = {
      icon: {
        url: '../../assets/imgs/numeroquestion_3x.png',
        size: {
          width: 32,
          height: 32
        }
      },
      animation: \'BOUNCE\',
      position: {
        lat: latitude,
        lng: longitude
      }
    };

    const marker = this.googleMap.addMarkerSync(markerOptions);

This is my code when a set my custom pointer.

I also tried to wrote assets/imgs/numeroquestion_3x.png but same problem.

The xcode log write:
CRANOMETRE[4505:1152648] ERROR: map_0_564812902358 Can not load image from 'http://localhost:8080//./assets/imgs/numeroquestion_3x.png'.

@wf9a5m75 I tried this but the fix is for Android and for iOS the problem still here.

If you can't solve the problem by yourself, please share your project files on GitHub

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cedrickbae picture cedrickbae  路  4Comments

splitice picture splitice  路  5Comments

rosnaib11 picture rosnaib11  路  5Comments

wf9a5m75 picture wf9a5m75  路  3Comments

BTW18 picture BTW18  路  3Comments