We are using google map layer in our MAUI application and are facing issues with loading google maps on android devices with android version 13 and 14 using single tile. we are using ThinkGeo.Core.Async.GoogleMapsLayer and it is working fine on device with android version 11 but if I use same build with android version 14 map just shows white screen and does not load any images. On further analysis I found that on android version 13 and 14 multi-tile is loading map fine but map is not loading when I change it to single tile.
Also what is minimum RAM requirement for android device to use thinkgeo when using on older devices with 2 GB RAM I face random crashes while performing map operations.
Attaching error that I see in debug console when it tries to load map. error.txt (15.9 KB)
We couldn’t recreate the issue using MAUI v14.0.2, the following code works fine on both emulator Pixel 5 Android 14.0 and Android 13.0
MapView.MapUnit = GeographyUnit.Meter;
// Set the map extent
MapView.CenterPoint = new RectangleShape(-10786436, 3918518, -10769429, 3906002).GetCenterPoint();
MapView.MapScale = 34000;
var layerOverlay = new LayerOverlay();
var googleLayer = new GoogleMapsLayer("GoogleApiKey");
layerOverlay.Layers.Add(googleLayer);
MapView.Overlays.Add(layerOverlay);
await MapView.RefreshAsync();
Please use the latest version v14.0.2 NuGet Gallery | ThinkGeo.UI.Maui 14.0.2 and have another try. If the issue still exists, let us know the model of the android device you were using and we can have a close test.
The error.txt you provided shows the glide exception. So you are using glide in your maui project to load the images, right? So how does it work with ThinkGeo MAUI component, can you share the code with us?
ThinkGeo MAUI component doesn’t have a RAM requirement itself, of course everything depends on how many features, how big the images are rendered, etc. You have total control over the memory which means you can, for example avoid rendering a layer with complicated features when the current device has less than 2G RAM, or something.
Attaching project sample for your reference and screenshot of android emulator with android version 13.I am also not using glide library to load images its just empty project with thinkgeo library and error messages are thrown while using in hybrid maptype.
After adding async and await and restructuring code I am still not able to load map in hybrid maptype and single tile. On analyzing I found, map is loading fine on mobile device emulators but is not loading when I use tablet device emulators. seems like on mobile devices as screen size is small the image size is small and its loading it fine but on devices with large screen it tries to load large image and it fails. attaching both screenshots of mobile vs tablet.
Can you let me know the configuration of your android emulator, I can so make sure to launch the exact same environment?
By the way here is what it looks like running on iPad Pro with iOS 17.4. My Google License returns up to 640*640 image and that’s why it’s not fullfilling the entire screen.
We are using Windows machine and this issue is not happening on Macbook and on iPad’s. It is just happening on Android tablets that to specifically on Android version 13 and 14 while running on windows platform. I even tried it on different windows machine thinking it might be issue with my machine, but map is still not loading. Please follow below steps to reproduce this issue.
Build Solution on Windows machine I am using windows 10
Create emulator with tablet configuration adding screenshot of my emulator configuration
Configure Google map to load in Hybrid maptype and SingleTile
Run application on Android tablet emulator.
Some more finding:
On MacBook even android tablet emulator is loading map images while running in debug mode, but if I generate APK from MacBook in release configuration and try to run on real Android tablet device its not loading map.
On Windows while running application on debug itself wont load map and you can see errors getting displayed in your debug console while running on tablet emulator.
Screenshot of error message in debug console while running on windows machine and Android tablet emulator with Android version 13. This error is thrown each time I zoom in or zoom out of map.
After trying your solution I was still not able to load map but I figured out the root cause. When I try Free tier Google API Key I am able to load map as Images return by API is 1280 x 1286. But the Google API key that we are using is Paid key and provides higher resolution images 1930 x 1236 in this scenario we are facing issue. As we are targeting our application on tablets we require higher size images so that there are less white bars shown on side when map loads. Please try this on Windows machine Attaching both screenshot below.
The “Free Key” is requesting High Res images (Scale = 2) from Google Map Server when running on an iPad. It returns up to 640x640 (Scale = 2) image, which is 1280px by 1280 px. Check out the google doc for the detail; Get Started | Maps Static API | Google for Developers
The premium key should return the image with the same Scale but larger resolutions. For example if we request a 800 x 800 (scale 2 ) image, a regular Google Key returns a 1280 x 1280 image while the premium key returns 1600 x 1600 image.
As a result if the free key works, the premium key should for sure works as well. I think your Paid Key might have some issues. Can you test it by sending a single request to google server using that key see if the image is successfully returned?
Thanks for the meeting just now. As I don’t have a premium key to test, can you do the following for me:
Add the following 2 lines to your code
ThinkGeoDebugger.LogType = ThinkGeoLogType.WebRequest;
ThinkGeoDebugger.LogLevel = ThinkGeoLogLevel.All;
And you will see something like following in the Visual Studio output window:
That’s the link sent to Google Map Server to fetch the image. Open the link in a browser on the same Android emulator see if the image loads correctly.
If #2 works fine, please send over the returned image to us. (You can just open the link on Windows and save/send us the image)
Verified the API calls think geo is sending to google server and its loading image fine in browser with premium key attaching images received from API as zip file. I have added both free version of image as well as paid version.
I tried ThinkGeo.UI.Maui 14.1.0-beta033 version and I am still not able to load google map images. In output window I am getting below thinkgeo message.
Switch to (mapType.RoadMap, PremiumKey), with which the map shows correctly on your side, and send me the same " Fetched Image from Google Maps Server:" string from the output window.
Switch to (mapType.Hybrid, RegularKey), and send me the same string from output.
Let me know if you see any exceptions in the output for the above 2 cases.
Thanks for the info! I got some answers but in fact now have more questions. For example the Hybrid map returned is (1930 * 1176), but the returned roadmap is (2048*1248). I was expecting they have identical settings with the only exception of MapType, are they? or the google server just returns different resolution for different map type even the request size are the same?
Anyway, I think the best way to tackle it is to have a key and run the demo on our side. I will talk to the right person in my company who will try to contact google see if they can give us a test account. Of course if you guys can create a temp key for us or something, that’ll be awesome!
After adding latest beta version of SkiaSharp.Extended.UI.Maui version 3.0.0-preview.7. I am constantly able to reproduce map load issue even with free key please give it a try and check if you able to reproduce it attaching the sample for your reference.
I am using ThinkGeo.UI.Maui Version=14.2.0-beta004
Using Android tablet emulator Nexus 9 or Nexus 10 with android version 13 or android version 14 on windows machine.