Skip to content

Hello SDK

In this guide you will learn how to create a Hello World app using the Maps SDK for Android.


First, get an API key token, see the Getting Started guide.

Download the Maps & Navigation SDK for Android archive file

Download the HelloSDK project archive file or clone the project with Git

See the Configure Android Example guide.

Run the example

In Android Studio, from the File menu, select Sync Project with Gradle Files

Hello SDK example Android screenshot

An android device should be connected via USB cable.
Press SHIFT+F10 to compile, install and run the example on the android device.

How it works

Android example screenshot

You can open the MainActivity.kt file to see how to create an empty app and import the Maps SDK for Android.

 1// Kotlin code
 3import android.os.Bundle
 6import com.generalmagic.sdk.examples.util.SdkInitHelper
 7import com.generalmagic.sdk.examples.util.SdkInitHelper.terminateApp
 9class MainActivity : AppCompatActivity()
11 override fun onCreate(savedInstanceState: Bundle?)
12 {
13     super.onCreate(savedInstanceState)
14     setContentView(R.layout.activity_main)
15     val app = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
16     val token = app.metaData.getString("com.generalmagic.sdk.token") ?: "YOUR_TOKEN"
17     if (!SdkInitHelper.init(this, token))
18     {
19         // The SDK initialization was not completed.
20         finish()
21     }
22 }
23 override fun onDestroy()
24 {
25     super.onDestroy()
26     // Deinitialize the SDK.
27     SdkInitHelper.deinit()
28 }
29 override fun onBackPressed()
30 {
31     terminateApp(this)
32 }
Note the 2 import statements at the top:
import com.generalmagic.sdk.examples.util.SdkInitHelper
import com.generalmagic.sdk.examples.util.SdkInitHelper.terminateApp
The MainActivity overrides the onCreate function which
initializes the SDK:
SdkInitHelper.init(this, token)

Android Examples

Maps SDK for Android Examples can be downloaded or cloned with Git