# Mobile SDK Tutorial for Beginners

This is a step-by-step tutorial using a sample project for mobile SDK for Android and iOS.

# Android

## Install Android Studio

Download and install Android Studio ([IDE for Android development](https://developer.android.com/studio/)).

After you complete the download, launch the app and finish the installation.

## Import the project

Choose File > New > Project from Version Control > Git.

![](/assets/image-20191022-132758.ca1bb450b6ce7ea8b79272d1d1d8d0024c0c09d020e804aa909d5cfb24c60f62.ad50cbca.png)

Type git@github.com:treasure-data/td-android-sdk.git in the URL field.

SelectClone.

![](/assets/image-20191022-132814.3a974b043bf53e49fe071bc698b08e091f06526c02aa87f9ae3306a8463a969e.ad50cbca.png)

The build begins automatically.

Review the projects listed on the left.

![](/assets/image-20191022-132822.2f65428f529650eac415220f37d099dbceced0fd5bf39a7320b49426ff4025ed.ad50cbca.png)

## Configure the Parameters

From Navigate > Class menu, search for any files. For example, search DemoApp.

Select Enter.

![](/assets/image-20191022-132830.c8d2924eb81a3c400409ffa220212b2c0459fad9562d6e451cfd93bdec5594a3.ad50cbca.png)

The file opens in the editor.

Modify the following parameters:

API KEY

DB Name

Table Name

![](/assets/image-20191022-132839.99dbf9da06a23bfef8abfe547585283a2159852a804e866fe9cc94cbe5ada618.ad50cbca.png)

If you are going to send commands to regions other than the US region, add the following code to the *onCreate* function.


```java
// set endpoint to Tokyo region.

TreasureData.initializeApiEndpoint("https://tokyo.in.treasuredata.com/");
```

## Create Virtual Device

To run the sample app in the emulator, you need to [create a virtual device](https://developer.android.com/studio/run/managing-avds) first.

## Run the Demo App

Select example from the project select field.

Select Run.

![](/assets/image-20191022-132851.1de3b677f514ecd9e216f96af21418e63216c23dd2d3f8e0bbe2d2915416f5c6.ad50cbca.png)

Select the virtual device created in the preceding step.

Select OK.

![](/assets/image-20191022-132903.c03cce8452e6b67f41eb724321f6fa833d861f3d422c60f80490a86f87ba4c10.ad50cbca.png)

You can see the demo application running in your emulator.

![](/assets/image-20191022-132944.06c88c944b41983fcabb7b833756a8d88d7da88d2dc641979b8e83cfb1c9e7ce.ad50cbca.png)

Select Upload , the events are uploaded to TD.

You can see the records on the TD Console in minutes. For example:

![](/assets/image-20191022-132954.ce83f7ff7463baa3530d11b7bc0e0ef6d9ad8c7e301a3585c2e996d4041af2a1.ad50cbca.png)

# iOS

## Install Dependencies


```bash
$ git clone git@github.com:treasure-data/td-ios-sdk.git
$ cd td-ios-sdk/TreasureDataExampleSwift
$ gem install cocoapods
$ pod install
```

## Open the Project in Xcode

Launch the Xcode app, and go to File > Open.

Select the TreasureDataExampleSwift.xcworkspace file, not TreasureDataExampleSwift.xcodeproj.

![](/assets/image-20191022-133009.5031fe7f97556d8e8b9a0929987deb0b982ebea9b4b4b6c2a52cefbacd4f7b6c.ad50cbca.png)

## Run the Demo App

Select Run at the top of the screen. The simulator starts automatically.

![](/assets/image2021-4-26_19-49-10.fd14f1f2c2268b8d9993353b628ccb530fa24585fb3fc59e03e0f11ce3b2cb04.ad50cbca.png)

Type your configuration (APIKEY, DB etc...) on your app.

Add the event and upload.

![](/assets/image2021-4-26_19-48-52.d01d0bf1aa08623e5887d52571ede1a2924d7f1ac8ede4629154834b1c61423e.ad50cbca.png)

The results are can be seen on the TD Console within a few minutes.

![](/assets/image2021-4-26_19-48-25.08ae0d97bbb017c3e1b7e35fe6860a4d01ae7c8cf23b74064115278b08fa9c2e.ad50cbca.png)