Map Markers and Google sheets (download images from Googlesheets speed over network is slow)

OSM (OpenStreetMap) tiles are the map images provided by OpenStreetMap. These tiles are used to create the map images displayed on your Android when you use the MIT Map component. (Map uses OSM tiles to provide its map display) MIT's mapping components point to these map images stored on OSM's map servers. The OSM Tiles are the online images displayed in your app using the Map component. The MIT Map component instructs the OSM map server which images the developer wants to display.

OSM tiles are in contrast to Google Map Tiles( used to produce a Google Map). App Inventor can also use Google Map Tiles to display a map by using the WebViewer url. App Inventor does not have a map component to directly access Google Map tiles. Prior to about 2018, App Inventor developers only had the option to use Google Map Tiles to display a map. OSM Tiles link provides links to numerous discussions about these tiles.

Is this what you wanted to know Mark?

1 Like

Yes, little over my head but thanks.

Personally, I wouldn't use Google Drive for hosting the files. Every time you make a call it's going to try to potentially authenticate you and that will slow down image loading time. Instead, you probably want to host external images on a CDN that can handle geographic distribution of your users to provide speed. You may also want to have your app cache the images if they are going to be accessed frequently as App Inventor does not do this natively for images loaded over HTTP.

Interesting, not heard about that before.....I guess google does check to see if you are a signed in user? Even if the file is public ?

Authorized was the more appropriate term, but yes there's going to be some security check to see that the file is readable when requested. With most CDNs it's assumed to be true by design that the resources are accessible anonymously. And my guess (although I haven't checked), is that Google will try to redirect to a login prompt which the Image will ignore because it doesn't have an appropriate content type.

Thanks for your input Evan. Not sure what or where to find CDN servers, can you please elaborate on this. As I mentioned before, when I created a simple app that reads the hyperlink(which references the image location) from a google drive sheet. I have very little delay. My guess is that the issue lies somewhere in the location sensor and map. I will let you know what I find out.

Thanks.

Well guys, I made some of you suggested changes to my app. changed the location time interval and distance properties as well as removing notifications. App is still having problems. If i open my Google drive sheet and click on hyperlink image comes down fine.. i created a app that has a list view with hyperlinks in it.. when i open it i see the list. I'll click on one and it takes several seconds before it gets highlighted, but no image comes down. I don't know if its my phone that has issues or app inventor servers are the problem. Galaxy s9 android 10. somebody's got to figure this out. Please.

Thanks for your help!

1 Like

If you just provide a hard-coded lat/long do you see any performance issues? If so, that indicates that it's taking time to get the location updates. If not, there is an issue somewhere else in the code path. There's nothing going through our servers in this situation as the app is going directly to your Google Sheet.

I did run a little test with wget, 1.2mb file download from google drive and from my own VPS server
Both returned download times of 0.4 seconds (tried @ 5 times with each)
Not saying my VPS would be as fast as a CDN server, but the additional cruft associated with a google drive download doesn't seem to impact on download speed.

The original issue @TIMAI2/@ewpatton was a complaint that using GoogleSheets over a cell network is taking significantly longer to transfer string coded images than over a WIFI network. Mark seemed happy with his WIFI results. No network, other than a 5G possibly can compete with a competent WIFI network. I can't see how he would get an improvement in network using his own VPS or CDN server. Network is slow compared to WIFI, isn't it?

Mark could consider the process of converting a png image to a string and the time it takes to access the string image on a GoogleSheet and reconstruct the image into a png on his Android as a possible choke point. The Android cpu has to do the conversion.

Would storing his images and files on a CloudDB (as png images ... he can do that without converting the image to a string) or FirebaseDB avoid a possible concern Google throttling access?

WIFI = rabbit
network = turtle

He is only storing links in his google sheet, image files are stored on google drive.

If by string you mean base64, these files are generally bigger than the image files themselves, but whether they would "come more quickly" starting as a "string" (given that all files are usually converted to base64 before moving them about on the web) is debatable. In any case you can only store 50,000 characters in a cell on google sheets. base64 encodes are usually larger than this.

1 Like

It seems to me a that app inventor is the problem, since i can get image download from a Hyperlink https://drive.google.com/uc?id=1X1v2c17znTA5GcVCr6u49LXXPmalaX9b typed into browser. Need to find a solution or switch app platform. I have not tried to store images on a different storage platform like OneDrive. I did try deleting app cache and had intermittent responses. Please advise.

Thank you Guys

Maybe Mark. Is the main issue still that network is slow compared to WIFI or now something else ?

Download your google drive image using a WebViewer ; with a fast WIFI it takes a second to display; using a 4G network, it takes a second+ . Pretty good. Testing using an apk and switching off WIFI to use only network

Use the code above to test; manually turn off WIFI to check network performance.

Your image on the google drive is 320x400 pixels jpeg. When you display the image on your app, it appears you use a ScalePictureToFit (slowing the rendering). You retrieve the image with the Web (you do not use a WebViewer which is fairly fast in both WIFI and network). You use a Web component in your example to grab the image link, then 'process' the results. Your example of quick response downloading from a hyperlink using your PC browser is analogous to using the WebViewer without all the processing you need to display the fish in an image component.

You said what you tried, but didn't show. If you want help, please construct an example app (without all your glitz) and post the code so someone can understand what you are asking your cell phone cpu to do. Remove the Map component and all the extensions and the several Clocks; see how it performs. Re-introduce the app elements one at a time and you might discover the time waster. Keep in mind, App Inventor is an asynchronous, single threaded compiler.

App Inventor graphics are known to be slow compared to what is possible using Android Studio and java based professional compilers. Android Studio is multithreaded and that may be what you think you need.

I'm assigning this to myself for now to investigate the performance to see if there's a bottleneck somewhere in the image loading code.

Here is simple example for downloading image. Does not work over cellular network.fishmarkertst.aia (2.0 KB)

@Mark_Parente The simple example works both using WIFI and over a cellular network if you compile the apk and install it on your phone. On my network, downloading is almost as fast as using WIFI. :slight_smile: How did I test? Tried using the compiled app on WIFI, then turned WIFI off on the device and turned network (data) to active.

Compile, install and try again and let us know what happens please. The example works fine on my TMobile 4G network.

Pretty fish :slight_smile:

Tested example aia compiled on Android 11 device. I have good internet / poor cellular/data coverage where I am. Takes @ 1 second on wifi to show the image, takes @ 5-7 seconds to show the image on cellular/data.

Yuk. Are you on 3G or 4G network Tim? My network takes about 300-400 ms longer to display a fish image than my fiberoptic WIFI/Internet. Your5 to 7 times longer than WIFI is dismal and NOT happening in Texas where I have an Android 4.2.2 that I tested. Is your provider throttling you?

No just poor coverage, even standing outside in the cold....
I have 4G but can only get the E to show up on my phone when on data.

Worth noting that the third fish image is @ 700kB in size. That won't help.