Custom Domain Name

Last Updated on : 2023-03-29 01:15:18download

To configure a custom domain name for your app, you can subscribe to Tuya’s Custom Domain Name service. After a custom domain name is configured and becomes effective, rebuild your app and pair smart devices with the app. Then, the network requests initiated by the app and newly-paired devices will be processed through the custom domain name. This helps improve the uniqueness of your app services.

Domain name types

An IoT app and respective smart devices in service initiate network requests to access a certain domain name for data transmission. Tuya supports two types of domain name services:

  • Default domain name service: Without any configurations, the apps developed based on Tuya’s App SDK services are built with the domain names provided by Tuya.

  • Custom Domain Name: Based on the Custom Domain Name service, network requests will be forwarded to a domain name customized to your needs. This topic describes how to configure a custom domain name.

    • The Tuya IoT Development Platform currently does not support your existing domain name. If you have special requirements, submit a ticket to request support.
    • If your app users cover those inside mainland China, the app domain name must first go through domain name filing. As a result, custom domain names are currently not supported. In this case, your app runs with the domain name provided by Tuya.

Things to note

For mobile apps

  • Minimum version: Custom Domain Name only applies to apps developed based on Smart Life App SDK v4.0 or later.

  • Special conditions: The custom domain name applies to main pages and features of the app. However, for H5 pages, specific third-party pages, and URLs configured on your own, or in other special conditions, the custom domain name might fail to take effect. In this case, you can submit a ticket to request technical support.

  • Online applications: After the custom domain name is configured, your app and respective smart devices in service will not make user-facing changes.

    However, if you failed to renew the subscription timely before your custom domain name expires, the domain name will become ineffective. Thus, users cannot access the respective app and smart devices through the domain name as expected.

For devices

Pair associated smart devices again with the app that has a custom domain name newly configured. Otherwise, the custom domain name will not take effect for these smart devices. They will still access the default domain name to transmit data.

Period of validity

A custom domain name is valid for one year after it takes effect. If the subscription expires, the domain name will be ineffective. Thus, users cannot access the respective app and smart devices through the domain name as expected.

You must renew the subscription timely before the custom domain name expires. Otherwise, certain problems and responsibilities might be incurred, including but not limited to that the app is disabled, existing paired smart devices cannot be accessed or used, and end users initiate complaints and claims for compensation. In this case, if you fail to renew the subscription, all relevant responsibilities and liabilities will be undertaken by you. For more information about the period of validity, see Step 6: Check validity and renew subscription.

Procedure

Subscribe
to service
Enter configuration
information
Wait for configuration
to be finished
Use domain
configuration file
Repackage
application
Timely renew
subscription

Step 1: Subscribe to service

  1. Log in to the Tuya IoT Development Platform.

  2. In the left-side navigation pane, go to App > App SDK > SDK Development.

  3. Click the target SDK-based app.

  4. Select the Custom Domain Name tab and click Configure Now to configure a custom domain name.

    Custom Domain Name
  5. Carefully read and accept the Custom Domain Name Service Agreement. The specific content of the agreement is subject to that displayed on the platform.

    Custom Domain Name

Step 2: Enter required information

Enter a keyword for the preferred domain name and choose one from the similar available domain names that appear. Currently, the top-level domain name can only be .net or .com.

Custom Domain Name

Step 3: Wait for the notification of finished configuration

  • This process will take three to five working days in most cases. The registration and configuration result will be sent to you by email and SMS.

    Custom Domain Name
  • During the registration and configuration, Tuya will help to register your specified domain name. In certain special conditions, the domain name might fail to be registered. Then, Tuya will notify you by email and SMS of the registration failure. You can select another custom domain name and submit the settings again.

    Custom Domain Name

Step 4: Use domain configuration file

After the custom domain name is configured, a domain configuration file for iOS and Android respectively will be generated on the Tuya IoT Development Platform. Download both files and add them to a directory of your SDK project.

  1. Log in to the Tuya IoT Development Platform.

  2. In the left-side navigation pane, go to App > App SDK > SDK Development.

  3. Click the target SDK-based app.

  4. Select the Custom Domain Name tab, and download the domain configuration file for the target mobile platform, iOS or Android.

    Custom Domain Name
  5. By default, a domain configuration file is named in the format of xxxxx.tcfg. You must rename it as t_cdc.tcfg before you continue with subsequent steps.

Use configuration file for iOS

  1. Import the domain configuration file.

    Rename the downloaded domain configuration file as t_cdc.tcfg, and add it to the root directory of your project: Project Settings > Target > Build Phases > Copy Bundle Resources.

    Custom Domain Name
  2. Confirm the version of Smart Life App SDK.

    The version of TuyaSmartHomeKit must be v4.0.0 or later.

  3. Verify the validity of the custom domain name.

    Before this step, the steps in Fast Integration with Smart Life App SDK must be finished.

    You can use this setting [TuyaSmartSDK sharedInstance].debugMode = YES to enable the SDK debug log feature. After the app starts, search for the log entry read custom domain config in the console to check whether data can be read out from the domain configuration file.

    If so, disable the SDK debug log feature, repackage the app, and then upload the package to Apple’s App Store to launch the app.

FAQs

  • Question 1: Data cannot be read out from the domain configuration file.

    • Analytics: After the app starts, the following log entry is printed in the console: Your project does not include a domain configuration file. To use a custom domain name, please go to the Tuya IoT Development Platform and download a domain configuration file. This log entry indicates that the domain configuration file is not found.

    • Solution: Repeat the steps as specified in Use domain configuration file for iOS.

  • Question 2: Data can be read out from the domain configuration file, but an error has occurred while parsing the file.

    Analytics: If the error t_cdc.tcfg file load failed! has occurred, the following causes might be included.

    Possible cause Solution
    The domain configuration file and the SDK do not have identical secret information, and thus the system failed to parse the file. We recommend that you verify that the bundle ID and secret information are correct.
    The domain configuration file is damaged and cannot be parsed. We recommend that you download the domain configuration file again.
    The version of TuyaSmartNetworkKit is legacy. Make sure this version in Podfile.lock is v4.0.2 or later. Run the command pod update TuyaSmartNetworkKit to update this component.

Use configuration file for Android

  1. Import the domain configuration file.

    Rename the downloaded domain configuration file as t_cdc.tcfg, and add it to the assets directory of your project.

    Custom Domain Name
  2. Confirm the version of Smart Life App SDK.

    The version in implementation 'com.tuya.smart:tuyasmart: xxx must be v4.0.0 or later.

  3. Verify the validity of the custom domain name.

    Before this step, the steps in Fast Integration with Smart Life App SDK must be finished.

    You can use this setting TuyaHomeSdk.setDebugMode(true); to enable the SDK debug log feature. After the app starts, search for the log entry read custom domain config in the console to check whether data can be read out from the domain configuration file.

    If so, disable the SDK debug log feature, repackage the app, and then upload the package to the target app store to launch the app.

FAQs

  • Question 1: Data cannot be read out from the domain configuration file.

    • Analytics: After the app starts, the following log entry is printed in the console: Your project does not include a domain configuration file. To use a custom domain name, please go to the Tuya IoT Development Platform and download a domain configuration file. This log entry indicates that the domain configuration file is not found.

    • Solution: Repeat the steps as specified in Use domain configuration file for Android.

  • Question 2: Data can be read out from the domain configuration file, but an error has occurred while parsing the file.

    Analytics: If the error t_cdc.tcfg file load failed! has occurred while filtering logs using “AssetsConfig”, the following causes might be included.

    Possible cause Solution
    The domain configuration file and the SDK do not have identical secret information, and thus the system failed to parse the file. We recommend that you verify that the package name, signature file, and secret information are correct.
    The domain configuration file is damaged and cannot be parsed. We recommend that you download the domain configuration file again.

Step 5: Repackage app

After the configurations are finished, repackage the app to make the custom domain name take effect.

Step 6: Check validity and renew subscription

You can check the validity period of the custom domain name on the Custom Domain Name tab and timely renew the subscription if needed.

Custom Domain Name

If you failed to renew the subscription timely before the service expires, the app and respective smart devices that are accessed through the custom domain name will not be accessed as normal. This will cause a serious impact on your business and your end users’ experience. For more information, see Period of validity.

Tuya will notify you by email or SMS of timely renewal prior to the expiration.

Mapping between domain name and data center

After you select a preferred domain name during the configuration, the system automatically generates and configures the second-level domain name or third-level domain name required by different data centers and services. The custom domain name is configured in this format: Service prefix-Data center.Specified custom domain name.

For example, if you select the domain name: customdomain.com, the following custom domain names are generated for the respective data centers:

  • Western America Data Center: Service prefix-us.customdomain.com
  • Central Europe Data Center: Service prefix-eu.customdomain.com
  • India Data Center: Service prefix-in.customdomain.com

A service prefix is an identifier of a specific service and is subject to Tuya’s setting. You can ignore this setting.