tencent cloud

Tencent Cloud Super App as a Service

Getting Running Mini Programs

Download
Focus Mode
Font Size
Last updated: 2026-08-26 10:42:48

Feature overview

Starting from version 2.4.3, the SDK provides APIs for querying the running status. Superapps can use these APIs to check whether a specific mini program is running, or get a list of currently running mini programs and mini games for scenarios such as multi-instance management and task switching.

API description

This API is used to get the object of the currently running mini program.

Returns the mini program/mini game instance that is currently in the foreground and being displayed. If the superapp is not displaying any mini program at the moment, this API returns nil.
/// Get the object of the currently running mini program
// @return TMFMiniAppInfo Mini program information
- (TMFMiniAppInfo *)currentApplet;
You can compare the appid of the returned mini program object with the appid of a specific mini program to determine whether the specific mini program is running. Example:
TMFMiniAppInfo *currentApplet =
[[TMFMiniAppSDKManager sharedInstance] currentApplet];

// The appid variable is the appid of the mini program to be checked
BOOL isCurrentRunning = [currentApplet.appId isEqualToString:appId];

Get a list of currently running mini programs and mini games.

runningAppletList returns all mini programs and mini games that have not been destroyed, including instances that are running and those in the keep-alive state.
// Get the list of mini programs that have not been destroyed (including running and keep-alive mini programs/mini games)
// @return Mini program array <TMFMiniAppInfo>
- (NSArray<TMFMiniAppInfo *> *)runningAppletList;
You can use the appType property of TMFMiniAppInfo to distinguish between mini programs and mini games:

NSArray<TMFMiniAppInfo *> *runningList =
[[TMFMiniAppSDKManager sharedInstance] runningAppletList];

NSMutableArray<TMFMiniAppInfo *> *miniAppList = [NSMutableArray array];
NSMutableArray<TMFMiniAppInfo *> *miniGameList = [NSMutableArray array];

// Filter running or keep-alive mini programs based on appType
for (TMFMiniAppInfo *appInfo in runningList) {
if (appInfo.appType == TMAAppTypeApp) {
[miniAppList addObject:appInfo];
}
}

// Filter running or keep-alive mini games based on appType
for (TMFMiniAppInfo *appInfo in runningList) {
if (appInfo.appType == TMAAppTypeGame) {
[miniGameList addObject:appInfo];
}
}



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback