{"id":27627201,"url":"https://github.com/treasure-data/td-android-sdk","last_synced_at":"2025-04-23T13:53:30.514Z","repository":{"id":8913047,"uuid":"10638704","full_name":"treasure-data/td-android-sdk","owner":"treasure-data","description":"Android SDK for Treasure Data","archived":false,"fork":false,"pushed_at":"2025-04-16T02:43:39.000Z","size":3276,"stargazers_count":22,"open_issues_count":3,"forks_count":13,"subscribers_count":79,"default_branch":"master","last_synced_at":"2025-04-16T02:50:49.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://api-docs.treasuredata.com/en/sdk/android-sdk/quickstart/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/treasure-data.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-12T08:07:46.000Z","updated_at":"2024-07-15T04:15:30.000Z","dependencies_parsed_at":"2024-05-28T09:12:41.426Z","dependency_job_id":null,"html_url":"https://github.com/treasure-data/td-android-sdk","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treasure-data%2Ftd-android-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treasure-data%2Ftd-android-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treasure-data%2Ftd-android-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treasure-data%2Ftd-android-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/treasure-data","download_url":"https://codeload.github.com/treasure-data/td-android-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250444196,"owners_count":21431601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-23T13:53:29.964Z","updated_at":"2025-04-23T13:53:30.503Z","avatar_url":"https://github.com/treasure-data.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Treasure Data Android SDK\n===============\n[\u003cimg src=\"https://travis-ci.org/treasure-data/td-android-sdk.svg?branch=master\"/\u003e](https://travis-ci.org/treasure-data/td-android-sdk)\n\nAndroid and Android TV SDK for [Treasure Data](http://www.treasuredata.com/). With this SDK, you can import the events on your Android and Android TV applications into Treasure Data easily.\n\n## Migration to version 1\n\nVersion 1 has major changes that are not backward compatible with previous versions. If you are upgrading from version 0.6.0 or earlier, your code will not run correctly without doing these following steps:\n- API endpoint has changed to Ingestion Endpoint. The default value is https://us01.records.in.treasuredata.com.\n- `initializeApiEndpoint(String apiEndpoint)` API is no longer available, please use `initializeSharedInstance(Context context, String apiKey, String apiEndpoint)` instead.\n- Server side upload timestamp feature is removed.\n- New `enableAutoAppendLocalTimestamp` and `disableAutoAppendLocalTimestamp` APIs to help automatically track local timestamp.\n- `uuid` is now reserved column name. If you try to add value to event's `uuid` key, you won't see the column show up in the database.\n- Auto tracking of client id by adding `td_ip` field is no longer supported. Instead, use new `enableAutoTrackingIP` and `disableAutoTrackingIP` APIs.\n\n## Installation\n\nYou can install td-android-sdk into your Android project in the following ways.\n\n### Gradle\n\nIf you use gradle, add the following dependency to `dependencies` directive in the build.gradle\n\n```\ndependencies {\n    implementation 'com.treasuredata:td-android-sdk:1.1.0'\n}\n```\n\n### Maven\n\nIf you use maven, add the following directives to your pom.xml\n\n```\n  \u003cdependency\u003e\n    \u003cgroupId\u003ecom.treasuredata\u003c/groupId\u003e\n    \u003cartifactId\u003etd-android-sdk\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n  \u003c/dependency\u003e\n```\n\nThis SDK has [an example Android application project](https://github.com/treasure-data/td-android-sdk/tree/master/example/td-android-sdk-demo). The pom.xml would be a good reference.\n\n### Jar file\n\nOr put td-android-sdk-x.x.x-shaded.jar (get the latest [here](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.treasuredata%22%20AND%20a%3A%22td-android-sdk%22)) into (YOUR_ANDROID_PROJECT)/libs.\n\n## Usage\n\n### Initialize the Library at onCreate() in your Application subclass\nFor efficient API calls, we highly recommend initializing a `TreasureData` shared instance at the `onCreate()` method of your Application subclass.\n```\npublic class ExampleApp extends Application {\n\n  @Override\n  public void onCreate() {\n\n    // Initialize Treasure Data Android SDK\n    TreasureData.initializeEncryptionKey(\"RANDOM_STRING_TO_ENCRYPT_DATA\");\n    TreasureData.disableLogging();\n    TreasureData.initializeSharedInstance(this, \"YOUR_WRITE_ONLY_API_KEY\", \"API_ENDPOINT\");\n    TreasureData.sharedInstance.setDefaultDatabase(\"your_application_name\");\n    TreasureData.sharedInstance.setDefaultTable(\"your_event_name\");\n    TreasureData.sharedInstance.enableAutoAppendUniqId();\n    TreasureData.sharedInstance.enableAutoAppendModelInformation();\n    TreasureData.sharedInstance.enableAutoAppendAppInformation();\n    TreasureData.sharedInstance.enableAutoAppendLocaleInformation();\n  }\n}\n```\n\nWe recommend to use a write-only API key for the SDK. To obtain one, please:\n\n1. Login to the Treasure Data Console at http://console.treasuredata.com;\n2. Visit your Profile page at http://console.treasuredata.com/users/current;\n3. Insert your password under the 'API Keys' panel;\n4. In the bottom part of the panel, under 'Write-Only API keys', either copy the API key or click on 'Generate New' and copy the new API key.\n\nThen, you can use a shared instance from anywhere with the `TreasureData.sharedInstance()` method.\n\n### Use the shared instance\n\n```\npublic class ExampleActivity extends Activity {\n\n  public void onDataLoadSomethingFinished(long elapsedTime) {\n    Map\u003cString, Object\u003e event = new HashMap\u003cString, Object\u003e();\n    event.put(\"data_type\", \"something\");\n    event.put(\"elapsed_time\", elapsedTime);\n    TreasureData.sharedInstance().addEvent(\"events\", event);\n  }\n}\n```\n\n### Add an event to local buffer\n\nTo add an event to local buffer, you can call `TreasureData#addEvent` or `TreasureData#addEventWithCallback` API.\n\n```\n  View v = findViewById(R.id.button);\n  v.setOnClickListener(new OnClickListener() {\n    @Override\n    public void onClick(View v) {\n\n      final Map event = new HashMap\u003cString, Object\u003e();\n      event.put(\"id\", v.getId());\n      event.put(\"left\", v.getLeft());\n      event.put(\"right\", v.getRight());\n      event.put(\"top\", v.getTop());\n      event.put(\"bottom\", v.getBottom());\n\n      td.addEventWithCallback(\"testdb\", \"demotbl\", event, new TDCallback() {\n        @Override\n        public void onSuccess() {\n          Log.i(\"ExampleApp\", \"success!\");\n        }\n\n        @Override\n        public void onError(String errorCode, Exception e) {\n          Log.w(\"ExampleApp\", \"errorCode: \" + errorCode + \", detail: \" + e.toString());\n        }\n      });\n      \n      // Or, simply...\n      //    td.addEvent(\"testdb\", \"demotbl\", event);\n\n    }\n  });\n```\n\nSpecify the database and table to which you want to import the events. The total length of database and table must be shorter than 256 chars. Each table will cache no more than 10000 events.\n\nOn top of that, the length of key in event must not exceed 256 chars and the length of value in event must not exceed 10000 chars.\n\n### Upload buffered events to Treasure Data\n\nTo upload events buffered events to Treasure Data, you can call `TreasureData#uploadEvents` or `TreasureData#uploadEventsWithCallback` API.\n\n```\n  findViewById(R.id.upload).setOnTouchListener(new OnTouchListener() {\n    @Override\n    public boolean onTouch(View view, MotionEvent motionEvent) {\n\n      // You can call this API to uplaod buffered events whenever you want.\n      td.uploadEventsWithCallback(new TDCallback() {\n        @Override\n        public void onSuccess() {\n          Log.i(\"ExampleApp\", \"success!\");\n        }\n\n        @Override\n        public void onError(String errorCode, Exception e) {\n          Log.w(\"ExampleApp\", \"errorCode: \" + errorCode + \", detail: \" + e.toString());\n        }\n      });\n      \n      // Or, simply...\n      //   td.uploadEvents();\n            \n      return false;\n    }\n  });\n```\n\nIt depends on the characteristic of your application when to upload and how often to upload buffered events. But we recommend the followings at least as good timings to upload.\n\n- When the current screen is closing or moving to background\n- When closing the application\n\nThe sent events is going to be buffered for a few minutes before they get imported into Treasure Data storage.\n\n### Retry uploading and deduplication\n\nThis SDK imports events in exactly once style with the combination of these features.\n\n- This SDK keeps buffered events with adding unique keys and retries to upload them until confirming the events are uploaded and stored on server side (at least once)\n- The server side remembers the unique keys of all events within the past 1 hours by default and prevents duplicated imports (at most once)\n\nAs for the deduplication window is 1 hour by default, so it's important not to keep buffered events more than 1 hour to avoid duplicated events.\n\n### Default values\n\nSet a default value if you want an event added to a table, a database, or any table or database to automatically set value for a key.\nIf you have multiple default values set to the same key, newly added event will have the default value applied and override in following order:\n1. Default value targeting all table and database will be applied first.\n2. Default value targeting all table in a database will then be applied.\n3. Default value targeting the table to which the event is added will then be applied.\n4. Default value targeting the table and database to which the event is added will then be applied.\n5. Finally, if the event has a value for the key, that value will override all default values.\n\nTo set default value:\n```\nTreasureData.sharedInstance().setDefaultValue(null, null, \"key\", \"Value\"); // Targeting all databases and tables\nTreasureData.sharedInstance().setDefaultValue(\"database_name\", null, \"key\", \"Value\"); // Targeting all tables of database \"database_name\"\nTreasureData.sharedInstance().setDefaultValue(null, \"table_name\", \"key\", \"Value\"); // Targeting all tables with \"table_name\"\nTreasureData.sharedInstance().setDefaultValue(\"database_name\", \"table_name\", \"key\", \"Value\"); // Targeting table \"table_name\" of database \"database_name\"\n```\n\nTo get default value:\n```\nString defaultValue = (String) TreasureData.sharedInstance().getDefaultValue(\"database_name\", \"table_name\", \"key\"); // Get default value for key targeting database \"database_name\" and table \"table_name\".\n```\n\nTo remove default value:\n```\nTreasureData.sharedInstance().removeDefaultValue(\"database_name\", \"table_name\", \"key\"); // Only remove default value targeting database \"database_name\" and table \"table_name\".\n```\n\n### Start/End session\n\nWhen you call `TreasureData#startSession` method, the SDK generates a session ID that's kept until `TreasureData#endSession` is called. The session id is outputs as a column name \"td_session_id\". Also, `TreasureData#startSession` and `TreasureData#endSession` method add an event that includes `{\"td_session_event\":\"start\" or \"end\"}`.\n\n```\n\t@Override\n\tprotected void onStart(Bundle savedInstanceState) {\n\t\t\t:\n\t\tTreasureData.sharedInstance().startSession(\"demotbl\");\n\t\t\t:\n\t}\n\n\t@Override\n\tprotected void onStop() {\n\t\t\t:\n\t\tTreasureData.sharedInstance().endSession(\"demotbl\");\n\t\tTreasureData.sharedInstance().uploadEvents();\n\t\t// Outputs =\u003e\u003e\n\t\t//   [{\"td_session_id\":\"cad88260-67b4-0242-1329-2650772a66b1\",\n\t\t//\t\t\"td_session_event\":\"start\", \"time\":1418880000},\n\t\t//\n\t\t//    {\"td_session_id\":\"cad88260-67b4-0242-1329-2650772a66b1\",\n\t\t//\t\t\"td_session_event\":\"end\", \"time\":1418880123}\n\t\t//    ]\n\t\t\t:\n\t}\n\t\n```\n\nIf you want to handle the following case, use a pair of class methods `TreasureData.startSession` and `TreasureData.endSession` for global session tracking\n\n* User opens the application and starts session tracking. Let's call this session `session#0`\n* User moves to home screen and destroys the Activity\n* User reopens the application and restarts session tracking within default 10 seconds. But you want to deal with this new session as the same session as `session#0`\n\n```\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t\t:\n\t\tTreasureData.setSessionTimeoutMilli(30 * 1000);  // Default is 10 seconds\n\t}\n\n\t@Override\n\tprotected void onStart() {\n\t\t\t:\n\t\tTreasureData.startSession(this);\n\t\t\t:\n\t}\n\n\t@Override\n\tprotected void onStop() {\n\t\t\t:\n\t\tTreasureData.endSession(this);\n\t\tTreasureData.sharedInstance().uploadEvents();\n\t\t\t:\n\t}\n```\n\nIn this case, you can get the current session ID using `TreasureData.getSessionId`\n\n```\n\t@Override\n\tprotected void onStart() {\n\t\t\t:\n\t\tTreasureData.startSession(this);\n\t\tLog.i(TAG, \"onStart(): Session ID=\" + TreasureData.getSessionId(this));\n\t\t\t:\n\t}\n```\n\n### Track app lifecycle events automatically\n\nApp lifecycle event tracking is optional and not enable by default. You can track app lifecycle events automatically using :\n`TreasureData#enableAppLifecycleEvent()`\n\nApp lifecycle events include : Application Install, Application Open, Application Update. You can disable the individual core events as the following:\n\n- Disable Application Install: `disableAppInstalledEvent()`\n- Disable Application Open: `disableAppOpenEvent()`\n- Disable Application Update: `disableAppUpdatedEvent()`\n\n### Track in app purchase events automatically\n\nIn app purchase event tracking is optional and not enable by default. To track in app purchase events automatically, you only need to add a line of code :\n`TreasureData#enableInAppPurchaseEvent()`\n\nIt outputs the following columns: \n\n- `td_android_event` : TD_ANDROID_IN_APP_PURCHASE\n- `td_iap_product_id` : productId (Purchase)\n- `td_iap_order_id` : orderId (Purchase)\n- `td_iap_product_price` : price (SKU detail)\n- `td_iap_quantity` : 1\n- `td_iap_product_price_amount_micros` : price_amount_micros (SKU detail)\n- `td_iap_product_currency` : price_currency_code (SKU detail)\n- `td_iap_purchase_time` : purchaseTime (Purchase)\n- `td_iap_purchase_token` : purchaseToken (Purchase)\n- `td_iap_purchase_state` : purchaseState (Purchase)\n- `td_iap_purchase_developer_payload` : developerPayload (Purchase)\n- `td_iap_product_type` : type (SKU detail), inapp for one-time product and subs for subscription\n- `td_iap_product_title` : title (SKU detail)\n- `td_iap_product_description` : description (SKU detail)\n- `td_iap_package_name` : packageName (Purchase)\n- `td_iap_subs_auto_renewing` : autoRenewing (Purchase)\n- `td_iap_subs_status` : Auto detection for subscription (New|Cancelled|Restored|Expired)\n- `td_iap_subs_period` : subscriptionPeriod (SKU detail for subscription)\n- `td_iap_free_trial_period` : freeTrialPeriod (SKU detail for subscription)\n- `td_iap_intro_price_period` : introductoryPricePeriod (SKU detail for subscription)\n- `td_iap_intro_price_cycless` : introductoryPriceCycles (SKU detail for subscription)\n- `td_iap_intro_price_amount_micros` : introductoryPriceAmountMicro (SKU detail for subscription)\n\nThis SDK can track in app purchase events for Android application using both Google Play Billing Library and In-app Billing with AIDL . You must add the following ProGuard rule to keep AIDL classes using by the SDK to your project if your application is developed using In-app Billing with AIDL api.\n\n```\n-keep class com.android.vending.billing.** { *; }\n```\n\n### Opt out \n\nDepending on the countries where you sell your app (e.g. the EU), you may need to offer the ability for users to opt-out of tracking data inside your app.\n\n- To turn off auto tracking application lifecycle events (when application lifecycle event tracking is enabled) : `TreasureData#disableAppLifecycleEvent()`.\n- To turn off auto tracking in app purchase events(when in app purchase event is enabled) : `TreasureData#disableInAppPurchaseEvent()`.\n- To turn off custom events (the events you are tracking by `TreasureData#addEvent`, `TreasureData#addEventWithCallback` ) : `TreasureData#disableCustomEvent`. To turn on it again :  `TreasureData#enableCustomEvent`\n\nYou can query the state of tracking events by using : `TreasureData#isAppLifecycleEventEnabled()`, `TreasureData#isInAppPurchaseEventEnabled()` and `TreasureData#isCustomEventEnabled()`.\nThe states have effects across device reboots, app updates, so you can simply call this once during your application.\n\n## About error codes\n\n`TreasureData#addEventWithCallback` and `TreasureData#uploadEventsWithCallback` call back `TDCallback#onError` method with `errorCode` argument. This argument is useful to know the cause type of the error. There are the following error codes.\n\n- `init_error` :  The initialization failed.\n- `invalid_param` : The parameter passed to the API was invalid\n- `invalid_event` : The event was invalid\n- `data_conversion` : Failed to convert the data to/from JSON\n- `storage_error` : Failed to read/write data in the storage\n- `network_error` : Failed to communicate with the server due to network problem \n- `server_response` : The server returned an error response\n\n\n## Additional configuration\n\n### Endpoint\n\nThe API endpoint (default: https://us01.records.in.treasuredata.com) can be changed. For example:\n\n```\n    td = new TreasureData(this, \"your_api_key\", \"https://specifying-another-endpoint.com\");\n```\n\n### Encryption key\n\nIf you've set an encryption key via `TreasureData.initializeEncryptionKey`, our SDK saves the event data as encrypted when called `TreasureData#addEvent` or `TreasureData.addEventWithCallback`.\n\n```\n    TreasureData.initializeEncryptionKey(\"hello world\");\n        :\n    td.addEventWithCallback(...)\n```\n\n### Default database\n\n```\n\tTreasureData.sharedInstance().setDefaultDatabase(\"default_db\");\n\t\t:\n\tTreasureData.sharedInstance().addEvent(\"demotbl\", …);\n```\n\n### Adding local timestamp to each event record automatically (enabled by default)\n\nBy default, local timestamp will be added to event's `time` key automatically. If you `disableAutoAppendLocalTimestamp` without adding `time` key to the event yourself, the server will add server side timestamp to `time` column. You can also auto track local time with custom column. If so, the `time` column will have server side timestamp.\n\n```\n    // Use local time as `time` column\n    TreasureData.sharedInstance().enableAutoAppendLocalTimestamp();\n\n    // Add local time as a customized column name\n    TreasureData.sharedInstance().enableAutoAppendLocalTimestamp(\"custom_time\");\n\n    // Disable auto append local time\n    TreasureData.sharedInstance().disableAutoAppendLocalTimestamp();\n```\n\n### Adding UUID of the device to each event automatically\n\nUUID of the device will be added to each event automatically if you call `TreasureData#enableAutoAppendUniqId()`. This value won't change until the application is uninstalled.\n\n```\n\ttd.enableAutoAppendUniqId();\n\t\t:\n\ttd.addEvent(...);\n```\n\nIt outputs the value as a column name `td_uuid`.\n\nYou can reset the UUID and send `forget_device_uuid` event with old UUID using `TreasureData#resetUniqId()`. \n\n### Adding an UUID to each event record automatically\n\nUUID will be added to each event record automatically if you call `enableAutoAppendRecordUUID`. Each event has different UUID.\n\n```\n\ttd.enableAutoAppendRecordUUID();\n\t// If you want to customize the column name, pass it to the API\n\t// td.enableAutoAppendRecordUUID(\"my_record_uuid\");\n\t\t:\n\ttd.addEvent(...);\n```\n\nIt outputs the value as a column name `record_uuid` by default.\n\n### Adding Advertising Id to each event record automatically\nAdvertising Id will be added to each event record automatically if you call `enableAutoAppendAdvertisingIdentifier`. You must install Google Play Service Ads (Gradle `com.google.android.gms:play-services-ads`) as a dependency for this feature to work. User must also not turn on Limit Ad Tracking feature in their device, otherwise, Treasure Data will not attach Advertising Id to the record.\nDue to asynchronous nature of getting Advertising Id, after enableAutoAppendAdvertisingIdentifier method called, it may take some time for Advertising Id to be available to be added to the record. However, Treasure Data does cache the Advertising Id in order to add to the next event without having to wait for the fetch Advertising Id task to complete.\n\n```\ntd.enableAutoAppendAdvertisingIdentifier();\n// If you want to customize the column name, pass it to the API\n// td.enableAutoAppendAdvertisingIdentifier(\"my_advertising_id_column\");\n:\ntd.addEvent(...);\n```\n\nIt outputs the value as a column name `td_maid` by default.\n\n\n### Adding device model information to each event automatically\n\nDevice model information will be added to each event automatically if you call `TreasureData#enableAutoAppendModelInformation`.\n\n```\n\ttd.enableAutoAppendModelInformation();\n\t\t:\n\ttd.addEvent(...);\n```\n\nIt outputs the following column names and values:\n\n- `td_board` : android.os.Build#BOARD\n- `td_brand` : android.os.Build#BRAND\n- `td_device` : android.os.Build#DEVICE\n- `td_display` : android.os.Build#DISPLAY\n- `td_model` : android.os.Build#MODEL\n- `td_os_ver` : android.os.Build.VERSION#SDK_INT\n- `td_os_type` : \"Android\"\n\n### Adding application package version information to each event automatically\n\nApplication package version information will be added to each event automatically if you call `TreasureData#enableAutoAppendAppInformation`.\n\n```\n\ttd.enableAutoAppendAppInformation();\n\t\t:\n\ttd.addEvent(...);\n```\n\nIt outputs the following column names and values:\n\n- `td_app_ver` : android.content.pm.PackageInfo.versionName (from Context.getPackageManager().getPackageInfo())\n- `td_app_ver_num` : android.content.pm.PackageInfo.versionCode (from Context.getPackageManager().getPackageInfo())\n\n### Adding locale configuration information to each event automatically\n\nLocale configuration information will be added to each event automatically if you call `TreasureData#enableAutoAppendLocaleInformation`.\n\n```\n\ttd.enableAutoAppendLocaleInformation();\n\t\t:\n\ttd.addEvent(...);\n```\n\nIt outputs the following column names and values:\n\n- `td_locale_country` : java.util.Locale.getCountry() (from Context.getResources().getConfiguration().locale)\n- `td_locale_lang` : java.util.Locale.getLanguage() (from Context.getResources().getConfiguration().locale)\n\n### Auto tracking device IP\n\nDevice IP will be added to each event automatically in `td_ip` column if you call `enableAutoTrackingIP`. Note that the tracked IP address is the one when you upload the events to Treasure Data, not the one when you add the event.\n\n```\nTreasureData.sharedInstance().enableAutoTrackingIP();\n```\n\nTo disable auto tracking IP:\n\n```\nTreasureData.sharedInstance().disableAutoTrackingIP();\n```\n\n### Profiles API\n\nLookup for profiles via [Profiles API](https://docs.treasuredata.com/display/public/PD/Working+with+Profiles+and+the+Profiles+API+Tokens)\n\n```\n// Set your CDP endpoint to either:\n//   https://cdp.in.treasuredata.com        (US)\n//   https://cdp-tokyo.in.treasuredata.com  (Tokyo)\n//   https://cdp-eu01.in.treasuredata.com   (EU)\n//   https://cdp-ap02.in.treasuredata.com   (Seoul)\n//   https://cdp-ap03.in.treasuredata.com   (Tokyo)\nTreasureData.sharedInstance().setCDPEndpoint(\"\u003cyour_cdp_endpoint\u003e\");\n\nTreasureData.sharedInstance().fetchUserSegments(Arrays.asList(\"\u003cyour_profile_api_tokens\u003e\"),\n                                                Collections.singletonMap(\"\u003cyour_key_column\u003e\", \"\u003cvalue\u003e\"),\n                                                new FetchUserSegmentsCallback() {\n                                                    @Override\n                                                    public void onSuccess(List\u003cProfile\u003e profiles) {\n                                                        System.out.println(profiles);\n                                                    }\n                                                    @Override\n                                                    public void onError(Exception e) {\n                                                        System.err.println(e);\n                                                    }\n                                                });\n```\n\n### Enable/Disable debug log\n\n```\n\tTreasureData.enableLogging();\n```\n\n```\n\tTreasureData.disableLogging();\n```\n\n## Android version support\n\nAndroid SDK for Arm Treasure Data only supports any Android device running API 28 (Android 9.0) and higher\n\n| Codename           | Version | API    | v0.6.0             | v1.0.0             | v1.0.1             | v1.1.0             |\n| :----------------- | :------ | :----- | :----------------- | :----------------- | :----------------- | :----------------- |\n| Android 14         | 14      | 34     | not tested         | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Android 13         | 13      | 33     | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Android 12         | 13      | 31, 32 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Android 11         | 11      | 30     | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Android 10         | 10      | 29     | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Pie                | 9.0     | 28     | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| Oreo               | 8.1     | 27     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Oreo               | 8.0     | 26     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Nougat             | 7.1     | 25     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Nougat             | 7.0     | 24     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Marshmallow        | 6.0     | 23     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Lollipop           | 5.1     | 22     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Lollipop           | 5.0     | 21     | :white_check_mark: | not tested         | not tested         | not tested         |\n| KitKat             | 4.4     | 19     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Jelly Bean         | 4.3     | 18     | :white_check_mark: | not tested         | not tested         | not tested         |\n| Jelly Bean         | 4.2     | 17     | not tested         | not tested         | not tested         | not tested         |\n| Jelly Bean         | 4.1     | 16     | not tested         | not tested         | not tested         | not tested         |\n| Ice Cream Sandwich | 4.0     | 15     | not tested         | not tested         | not tested         | not tested         |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreasure-data%2Ftd-android-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreasure-data%2Ftd-android-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreasure-data%2Ftd-android-sdk/lists"}