Implementing Google Maps V2 in KonyOne Cross Platform Mobile Apps

In this post, we will discuss some of the common issues that developers face while implementing Google Maps in mobile apps developed using Kony Studio. Google Maps Android API V1 has been officially deprecated as of December 3rd, 2012. So, all the new apps developed should use an API key of version V2. However, apps using V1 will continue to work on devices. Existing and new developers are encouraged to use Google Maps Android API V2. Here we will talk about the common issues that we face while integrating Google Maps V2 in Kony mobile apps and how to mitigate these issues.

  • While running the app on the device, if you are getting a horizontal zoom bar CaptureCaptureon the Map as shown in fig (b), then your app is using V1 which is no more supported. If you are using Google Maps Android V2 then you will get a vertical zoom on the device as shown in fig(a)
  • Unlike Google Map V1, V2 does not work on emulator, so you need to test it on devices directly. Devices with Android 2.2 and above are only supported by Maps V2.
  • Even after using Google Maps Android V2, if you are getting a blank screen on the device, it may be problem with KonyOne studio version and its plugins. Kony supports Android V2 Maps only from GA-5.0.7 onwards and your android plugins in Kony Studio should be updated to Android-5.0.8. You can download the available 5.0.7 version from http://developer.kony.com/KonyReleaseskony and install it.
  • Now after installing 5.0.7, you will get an option to upgrade to 5.0.11. When you verify the plugin details, you will notice IDE version as – 5.0.7 and Android plugin version as – 5.0.6. You can upgrade it to Kony IDE 5.0.11 & Android 5.0.8 or above, as mentioned below.
  • To update your plugins, from the studio Menu Bar, navigate to “Help” > “Check for Updates”.
  • This will give you the latest plugin details. Select the respected plugin which you want to update and it will update the plugins in your Kony Studio.

Steps to generate android map key and integrating it in Kony application

           To configure Google Maps API Key v2 for Android, follow these steps:

  • You need the Google Maps API key for Android in order to enable Maps in the applications you develop for Android platform. Maps API keys are linked to specific certificate/package pairs, rather than to users or applications. You only need one key for each certificate, no matter how many users you have for an application. Applications that use the same certificate can use the same API key. For generating maps API key for Android, you need to provide the fingerprint of the signed certificate.In the Google Maps Android v2 section, navigate to Displaying Certificate information

Displaying Certificate information

  • The Maps API key is based on a short form of your application’s digital certificate, known as its SHA-1 fingerprint. The fingerprint is a unique text string generated from the commonly used SHA-1 hashing algorithm. Because the fingerprint is itself unique, Google Maps uses it as a way to identify your application. To display the SHA-1 fingerprint for your certificate, first ensure that you have the certificate itself.

             Displaying the debug certificate fingerprint

  • Locate your debug keystore file. The file name is debug.keystore, and is created the first time you build your project. By default, it is stored in the same directory as your Android Virtual Device (AVD) files:
    •  OS X and Linux~/.android/
    • Windows Vista and Windows7C:\Users\your_user_name\.android\
  • List the SHA-1 fingerprint.
    • For Linux or OS X, open a terminal window and enter the following:
      • keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass  android -keypass android
    • For Windows Vista and Windows 7, run:
      • keytool -list -v -keystore “C:\Users\your_user_name\.android\debug.keystore” -alias androiddebugkey -storepass android -keypass android
  • If your application is registered with the Google Maps Android API v2 service, then you can request an API key. It’s possible to register more than one key per project.
  • To get the key, navigate to the Google API console
  • If your application is not registered with the service, then follow the procedure as mentioned below.
    • Click the Services link from the left-hand menu.
    • Activate the Google Maps API v2 service.
  • In the left navigation bar, click API Access.
  • In the resulting page, click Create New Android Key….
  • In the resulting dialog, enter the SHA-1 fingerprint, then a semicolon, then your application’s package name. For example: BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:75;com.example.mapexample
  • The Google APIs Console responds by displaying Key for Android apps (with certificates) followed by a forty-character API key, for example: AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0
  • In Kony Studio,Navigate to Application Properties > NativeApp > Android > Tags > Child tag entries under <application> tag. Add the following tag.
    • <meta-data android:name=”com.google.android.maps.v2.API_KEY” android:value=”MapV2-Key”/>
  • Replace the value of the Map V2 key with the generated Map v2 key.