[Google Maps Mobile] Android can't fetch image from url

[Google Maps Mobile] Android can't fetch image from url

  
Forge Component
(6)
Published on 21 Jul by OutSystems Labs
6 votes
Published on 21 Jul by OutSystems Labs

Hi everybody,


I'm trying to put a locationmarker and use the iconUrl-attribute of a mapmarker.

In iOS this works, but not in Android. I've had more problems with images getting fetched in iOS and not on Android in the same app.

First screenshot is Samsung Galaxy S6; second one is iPhone 6.

I have read that imageURLs with http are blocked and you need https, but the http URL works for iOS. The image is uploaded on our server.


Any ideas about this? Is this a known bug, is there a workaround (I cannot use binary data for my icon as the marker has iconURL attribute)

Hello Lars,


I've got an application where I'm using IconURL attribute from a mapmarker and it's working on both devices.

I didn't understand what you are assigning to IconURL attribute and I would like to understand it.

However, I'm just giving the image location (example: /SmartPower/img/SmartPowerCoreResources.location.png?BfwNK_cL6jFvamIjRY7nDg) instead of the absolute path.

Can you try the same?

Are you including the resources in the module?


Cheers,

Magda Pereira

Magda Pereira wrote:

Hello Lars,

I've got an application where I'm using IconURL attribute from a mapmarker and it's working on both devices.

...

Are you including the resources in the module?

Cheers,

Magda Pereira

Thank you for replying Magda. 

Importing the images worked for both Android and iOS!

Unfortunately I can't get away using images as resources, as I need to parse a rather large JSON file that has image urls in them later on, and show images on the fly. 


(I edited this message because I imported the icons in a wrong manner, i.e. in the resource folder instead of the image folder. )

Lars De Pauw wrote:

Magda Pereira wrote:

Hello Lars,

I've got an application where I'm using IconURL attribute from a mapmarker and it's working on both devices.

...

Are you including the resources in the module?

Cheers,

Magda Pereira

Thank you for replying Magda. 

Importing the images worked for both Android and iOS!

Unfortunately I can't get away using images as resources, as I need to parse a rather large JSON file that has image urls in them later on, and show images on the fly. 


(I edited this message because I imported the icons in a wrong manner, i.e. in the resource folder instead of the image folder. )


Lars, 

I would recommend replacing the URL 'http' protocol with 'https' to avoid mixed content issues.

Cheers,

Magda Pereira

Magda Pereira wrote:

Lars, 

I would recommend replacing the URL 'http' protocol with 'https' to avoid mixed content issues.

Cheers,

Magda Pereira


Hi Magda,

I've tried to fetch the url, replace 'http' with 'https', I've tried removing the protocol, but it is still the same:


In Android browser I can fetch images with the url, but in the Native Android app (and Outsystems Now app), they images still aren't shown.


I've read about downloading the image, putting it on a secure host and linking the url there, but that's not possible for my situation I think. Is there anything you know of that I can do (or other people who have the same problem as I do (search option didn't do the trick)?


Solution

Uhm, do you know why they're not being fetched? Any errors on the console?

It would be great if we can simulate that, but I'm being unable to replicate it. I can remember of 2 possible workarounds:

  • You can wrap it under a rest - The URL will point to a rest exposed by your module, and inside the rest you use a HTTPRequestHandler.RequestSubmit() and assign the binary data returned by the method to an output parameter.
  • You use the HTTPRequestHandler.RequestSubmit() and convert the returning binary to base64, on the iconURL parameter you pass it like below:
    • MapMarker.IconURL = "data:image/png;base64,"+convertedbase64

They're not gonna be the more performant workarounds (counting that they'll work), but unless you figure it out the reason why it's not loading the icon, I can't remember any others alternatives

Hope it helps 

Solution

Hi Henrique!

I'll try your workaround after I write this post, just wanted to put some screenshots up.


Perhaps worth noting, I need to get the images on the fly as they are displayed in Tweets and in google maps infowindows.

I made a new project consisting only of an imageview with the image url: http://www.willemen.be//sites//default//files//TCZ-Vue%20Toyota%20170327.jpg


iPhone (Outsystems Now app):


Android (Outsystems Now):



Outsystems web preview: