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

Did you try app with wifi off. Using only cellular service. I don't get images to appear. could it be a type setting?

I didn't test it out (I don't have my tablet rn). I just looked to see if you had a fact sheet component. Sorry.

you need to try it over cellular network. I don't know if your tablet supports cellular.

First run in companion emulator (no location sensor) I got your location and fish
Second test on android 11 device, I just get blue sea (middle of the Atlantic, 0,0), and app crashes
This with wifi (can't run companion without wifi)

1 Like

you try usb connection?

Tim,

The following link points to a fish picture that was uploaded to google drive spreadsheet using your image upload example.

" https://drive.google.com/uc?export=view&id=1X1v2c17znTA5GcVCr6u49LXXPmalaX9b"

over wifi it loads just fine. over cellular network it does not load. Can you tell me why this is happening? File size is 24KB.

Built a simple apk using these blocks

Image is loaded on both occasions

Using wifi it takes @ 1 second
Using data it takes between 5 and 10 seconds

this is probably to be expected....

See if a different url makes any difference ?

https://drive.google.com/uc?id=

instead of

https://drive.google.com/uc?export=view&id=
1 Like

Consider, numerous factors affect performance using network versus WIFI. These affect communication with GoogleSheets and displaying images on your Map:

  • the OSM servers operate using donated servers. The ability to refresh the Map is dependent on an OSM (not MIT) server. My experience using the Map component and WIFI (both compiled and using Companion) is that Maps update within several seconds to up to 30 seconds. It sometimes takes longer when the servers are busy. This is the performance observed without querying a GoogleSheet and using WIFI, if you query a sheet, it will take even longer to update the map. Map update performance using network is always slower than WIFI depending on whether I get a 4 or 3G network connection. Performance also depends on the strength of the network connection. You said: [quote="Mark_Parente, post:1, topic:22424"]
    most of the lakes are in rural areas where signal strength is limited.
    [/quote]

  • Performance on my old LG Android 4.2.2 is much slower than my Samsung tablet (Android 8.1). I expect that difference is a hardware issue (better cpu, better gps receiver and perhaps better OS software).

  • OSM can be very slow refreshing on weekends and during other high use periods, even when using WIFI. OSM throttles high use apps and refreshing becomes slower performing when lots of users of this 'free' service are active.

  • The gps receiver requires setting the GPS TimeInterval to about 20 or 30 seconds to ensure a satellite fix. The gps needs to know where it is. Setting TimeInterval to less than 20 seconds results on poor performance on my apps, especially when using the tool within a city's building canyons or in mountainous or hilly terrane.

Is better performance possible? Perhaps. Refactoring (revising the code) improved one of my apps that uses the gps receiver. A newer phone (with improved hardware) or a 5g network should make a difference with both OSM and Google Sheets.

  • Your app uses the Map component and many of its features. Turn off the compass etc. and see what happens. (I don't expect dramatic changes but these features require ms to execute).
  • fiddle with your 'MarkerDelay' Clock (that 3000 ms is suspicious and is at odds with your LS.TimeInterval).
  • You set the LocationSensor to attempt a satellite fix at 1000 ms ... don't do that, try 30000 ms (30 seconds). I expect you don't need to refresh the gps location and more important refresh the Map that often. Those activities uses up your network bandwidth.
  • You use a Notification.Alert to tell your user there is a Location Change. Since App Inventor processes commands asynchronously and that alert message persists for a few seconds, using the alert might be slowing down your performance.

You probably have other issues that need to be refactored. Your network performance will never approach you WIFI performance unless you are perhaps on a 5g network. Apps that depend on communications with the Web have natural bottle necks. You might be able to eliminate some and achieve a slight performance increase.

  • Do you know that it is possible to use OSM tiles without being connected? Your Map app caches OSM tiles.

Most of these comments refer to use of the Map component, not Google Sheets, however you are using BOTH together so what affects one affects the other. I expect you will have to live with slow performance on network when operating from you and your users 'isolated' environments.

Regards,
Steve

1 Like

Here's what I found when I simplified to image retrieval.
I created a app that has a button, list view and a image block. I filled the list view with a couple of links to images on my Google drive. these are the same links contained in my sheet. I built the app and installed it. went outside had two bars showing on my cellular strenngth, and app worked just fine. images took 2 to3 seconds to down load. So I'm guessing I need to work on some of the suggestions Steve so kindly suggested. Any other suggestions are welcome.

Thanks

What are OSM Tiles?

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