Version: 1.5
语言 : 中文
Request runtime permissions
Specify OpenHarmony Player command-line arguments

Integrating Tuanjie into OpenHarmony applications

This page describes how to integrate the Tuanjie Runtime Library into OpenHarmony applications using the Tuanjie as a Library feature.

You can use this feature to include Tuanjie-powered features, such as 3D/2D Real-Time Rendering, 3D model interaction, or 2D mini-games, into your application. The Tuanjie Runtime Library exposes controls to manage when and how to load, activate, and unload content within the application.

Important: The introduction of Used as a Library in your project might require you to adapt native and managed plug-ins to work properly for OpenHarmony.

How to export your project as a library

To use your Tuanjie project as a Library on OpenHarmony properly, you need to ensure that all configuration items in the OpenHarmony Build Settings are configured correctly.

To export your Tuanjie project, you can refer to: Export an OpenHarmony project - Use as A Library

How it works

You don’t need to do anything different when you build your OpenHarmony project from Tuanjie.

Every OpenHarmony Hvigor Peoject that Tuanjie generates has the following structure:

  • A library part in the tuanjieLib module that you can integrate into any other OpenHarmony Hvigor project. This contains the Tuanjie runtime and Player data.
  • A thin launcher part in the entry module that contains the application name and its icons. This is a simple OpenHarmony application that launches Tuanjie. You can replace this module with your own application.

To integrate Tuanjie into another OpenHarmony Hvigor project, you must include the tuanjieLib module of the generated OpenHarmony Hvigor project in your OpenHarmony Tuanjie Project through the build-profile.json5 file.

Limitations

Tuanjie doesn’t control the runtime lifecycle, so Used as a Library might not work for all possible use cases. Known limitations include:

  • You can’t load or integrate more than one instance of the Tuanjie runtime.
  • You might need to adapt third-party plug-ins (both native and managed) to work with the Tuanjie runtime.
Request runtime permissions
Specify OpenHarmony Player command-line arguments