To use Google Maps in any compiled Android application, you must have an API Key from Google. If not, maps will not show when using the Maps Control Type or Geolocation domain.
Note: This is not required when prototyping the application through Knowledge Base Navigator, as it already has its own Maps API Key
By default, the generated app use a default Android debug-certificate to sign the application when compiling.
That allows you to install the application on devices, directly with the *.apk file, but not through Google Play (as of GeneXus 15 U2), unless a custom certificate is created.
However, to use Google Maps service you need a special certificate called Map API Key, different from the previous one. This particular key is linked to the specific package name and the certificate mentioned before, in order to restrict the access.
This section explains how to obtain that key for your application.
The first thing to know is the fingerprint of the certificate that will sign the application (this is not required if while you are prototyping with the debug certificate provided by GeneXus).
To see this fingerprint run the following command, using the keystore provided by Android.
keytool -list -v -keystore <your_release_key.keystore> -alias <your_alias_name> -storepass <your_store_pass> -keypass <your_key_pass>
||Default (Android Application Signing)
||The filepath to the *.keystore file, whose value is set on Key Store File property.
||The alias of the *.keystore file, whose value is set on Key Alias property.
||The key store password to access the *.keystore file, whose value is set on Store Password property.
||The key password to access a particular key pair's private key.
This command tool will print an output like this:
Alias name: androiddebugkey
Creation date: Dec 01, 2016
Entry type: PrivateKeyEntry
Certificate chain length: 1
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: ********
Valid from: Mon Jan 01 08:04:04 UTC 2013 until: Mon Jan 01 18:04:04 PST 2033
Signature algorithm name: SHA1withRSA
The SHA1 value corresponds to the fingerprints.
Note: keytool program is installed on /bin directory of Java JDK
Go to Google API console and create a new API Key for your application.
The process to obtain that key can be done accessing to:
API Manager > Credentials > Create Credential > API Key.
The fingerprint of the step (1) allows adding exclusive access for this application. The following steps explain how to do it.
3.1 Select the API key
Click on the API Key created in step (2) from the list.
3.2 Check Android apps
On Key restriction section, check for Android apps option.
3.3 Add package/fingerprint
Click on "Add new package name and fingerprint" button, and complete the fields with your package name and fingerprint (from step (1))
3.4. Save your changes
4. Enabled Api
Depending the case, into the Google Apikey, is necessary enabled some Api, such as: Geolocation Api and/or Directions Api and/or Maps Static API, etc
Finally, set the Android Maps API Key property with the value of Google API console (notice that there is not longer a warning icon).
- For those developers who has applications in production with the previous default settings (i.e. the *.apk file signed with Artech credentials) must generate the fingerprint with the legacy values.
||Default (Android Application Signing, as of GeneXus 15 Upgrade 3)