Concept

Miniapp capabilities are designed with a modular approach and delivered to developers in Kit form. This enables you to easily connect to the Tuya ecosystem by integrating with the Kit.

Cloud Capabilities

Mini programs can utilize cloud-based value-added services through a subscription and authorization mechanism, including various capabilities such as statistical charts, device logs, weather services, and biological rhythms, to help developers meet their needs.

Cloud Capability Packages

Using Cloud Capabilities

Before developers can use cloud capabilities, they need to authorize configuration in the Mini Program Developer PlatformDevelopment Settings-Cloud Capabilities.

1. Subscribe to Resource Packages(Some cloud capabilities do not require a subscription, you can skip this step and proceed to the second step of authorization)

Choose the required capability to subscribe to cloud capability value-added service resource packages.

2. Authorization

3. After Authorization

The authorized cloud capabilities can be viewed in the authorized cloud capabilities section.

4. View Details

Developers need to carefully review the documentation for using cloud capabilities and pay attention to the expiration date of cloud capability resource package subscriptions and renew them in a timely manner.

Kit Capability packages

CategoryPackage name
Basic capabilitiesBaseKit
Miniapp container capabilitiesMiniKit
Tuya's internal basic capabilities and fine-grained general capabilitiesBizKit
Device control capabilitiesDeviceKit
Home management capabilities, such as getting home information.HomeKit
Media and voice capabilities, such as music sync.MediaKit
Map and positioning capabilitiesMapKit
Robot vacuum capabilitiesP2PKit

Usage

Configure extension capabilities

You can use Tuya MiniApp IDE to manually configure extension capabilities for your miniapp as required. MiniKit will be automatically imported as the basic capability to run the miniapp container.

In terms of the Kit versions, we recommend that you choose those marked as recommended.

Use Kit capabilities

  1. You can use ty.func() to import BaseKit, BizKit, and MiniKit as a basic capability plug-in.

    For example, you can use hideTabBar as a BaseKit capability, as shown in the following example:

    ty.hideTabBar({
      animation: xxx,
    });
  2. Except for BaseKit, BizKit, and MiniKit, other Kits must be prefixed with a namespace before they can be used.

    To get the namespace, remove the word Kit from the name and then lowercase the first letter. For example, the namespace for HomeKit is home.

    getCurrentHomeInfo is a HomeKit capability. Here is how it is used.

    ty.home.getCurrentHomeInfo({
      success(homeInfo) {},
    });

Select a Kit version

The Kit versions that you select determine whether your miniapp can run on the specified app.

Mobile apps and miniapps

When users scan the QR code of a miniapp with an app or tap a device on the app to run a miniapp, the system compares the existing environment settings of the app with those required by the miniapp. The miniapp can only start if the system is compatible.

The comparison rules involve:

  • Base library versions
  • Types and versions of Kit packages

Therefore, whether the miniapp can start and run depends on the respective base library versions, and types and versions of Kit packages.

Comparison of base library versions

A base library of a miniapp is the container responsible for loading the miniapp framework, and provides standard components and standard APIs required by the miniapp framework. For more information, see Base Library.

Each app integrates with a container or SDK of an unchanged version. The container version is further associated with multiple base library versions of the miniapp. Example:

App container version 2.4.1 can be associated with the following multiple base library versions: 2.2.4, 2.2.3, 2.1.20, 2.1.19, and 2.1.18.

Changes in the minor versions of the base libraries are backward compatible. As a result, the app will pull the latest associated base library version to run the miniapp.

If the base library version required by your miniapp is earlier than the latest base library version associated with the current app, backward compatibility is achieved.

If the current container version of the app is 2.4.1, and the latest associated base library version is 2.2.4:

  1. ✅ When the miniapp requires the base library version 2.1.15, the app pulls the base library version 2.2.4 to run the miniapp.
  2. ❌ When the miniapp requires the base library version 1.2.30, its major version differs from that of the app's associated base library. So the miniapp cannot be started due to incompatibility.
  3. ❌ When the miniapp requires the base library version 2.4.0, this required version is later than the latest base library version associated with the app. So the miniapp cannot be started due to incompatibility.

Comparison of Kit packages

Kit packages are designed to provide you with extension capabilities by means of Kits.

Each app integrates with Kits of unchanged types and versions. Backward compatibility is applicable to the minor versions of the Kits.

Before a miniapp is started, the system compares the types and versions of the Kits integrated into the app with those required by the miniapp. If backward compatibility is achieved, the miniapp can be started.

In the following example, the listed Kits are integrated into the app.

Kitversion
BaseKit2.2.3
MiniKit2.3.8
TYKit2.1.4
  1. ✅ When the miniapp requires BaseKit 2.1.2, MiniKit 2.3.7, and TYKit 2.0.7, these required types of Kits with compatible versions are already integrated into the app. So the miniapp can be started.
  2. ❌ When the miniapp requires BaseKit 2.1.2, MiniKit 2.3.7, TYKit 2.0.7, DeviceKit 2.1.6, DeviceKit is not integrated into the app. So the miniapp cannot be started.
  3. ❌ When the miniapp requires BaseKit 2.1.2 and MiniKit 2.4.0, the required MiniKit version is later than that integrated into the app. So the miniapp cannot be started.

View version details in the app

You can check the details of the container version and Kit versions in the app. In the top right corner of the miniapp, tap and hold the Close button for 10 seconds to bring up version details.

In the dialog box, the existing base library versions and Kit versions of the app are listed.