I am learning to build Android Google Map app on RAD Studio 11. However, I got crush when the app is being launched. If I change the API key point to another package name, the app can be launched but the map is empty.
Do anyone know what is the matter? How could I fix the problem? Many thanks in advance.
Regards, Kenny
CodePudding user response:
First, an API key is mandatory.
You need to create a project in Google Cloud Platform and enable Maps SDK for Android. When it's done you will get an API key.
On your Firemonkey application, you can add a TMapView
.
In project options > Application > Version info. > add a new line, with key apiKey
and value the api key you get from Google.
That's all. You can do it in All configuration
or only Android 32/64 bits
.
Check what version you run, and set the apiKey correctly.
Otherwise, this page describe you what I told : https://docwiki.embarcadero.com/RADStudio/Sydney/en/Mobile_Tutorial:_Using_a_Map_Component_to_Work_with_Maps_(iOS_and_Android)
If the Map is empty, it's possible that you didn't use the correct API.
CodePudding user response:
I unexpectedly found some hints from the following link. Although the article was written in 2019 but the advice still works from RAD Studio 11. Also, my device is using Android 11. Is the issue happened on all android device with version 9 or above? Strange!!!!
https://delphiworlds.com/2019/02/a-fix-for-using-tmapview-on-android-9-devices/
Thanks & regards! Kenny