Skip to content
Last updated

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).

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

Import the project

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

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

SelectClone.

The build begins automatically.

Review the projects listed on the left.

Configure the Parameters

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

Select Enter.

The file opens in the editor.

Modify the following parameters:

API KEY

DB Name

Table Name

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

// 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 first.

Run the Demo App

Select example from the project select field.

Select Run.

Select the virtual device created in the preceding step.

Select OK.

You can see the demo application running in your emulator.

Select Upload , the events are uploaded to TD.

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

iOS

Install Dependencies

$ 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.

Run the Demo App

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

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

Add the event and upload.

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