All Products
Search
Document Center

SuperApp:Perform operations on miniapps

Last Updated:Jan 22, 2026

After you integrate the WindVane or uni-app miniapp container into a native app, you can search for miniapps, obtain a list of miniapps, or start a miniapp.

Obtain a list of miniapps

The miniapp container SDK provides an interface for obtaining a list of miniapps. If you only want to obtain the miniapp list, you can directly use this interface. The callback methods of the interface are called from the UI thread. If you want to perform other operations, we recommend that you use the relevant APIs provided by SuperApp.

IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
 if (miniAppService != null) {
    miniAppService.getMiniAppList(this, new OnQueryMiniAppsListener() {
        @Override
        public void onSuccess(List<MiniAppInfo> miniAppInfos, String anchor) {
            // Return a list of miniapps. By default, a maximum of 10 miniapps can be obtained. The anchor parameter is used to obtain more miniapps.
        }

        @Override
        public void onFailed(int errorCode) {

        }
    });
 }

Search for miniapps

The miniapp container SDK provides an interface for searching for miniapps. If you only want to search for miniapps, you can directly use this interface. The callback methods of the interface are called from the UI thread. If you have other search requirements, we recommend that you use the relevant APIs provided by SuperApp.

IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
if (miniAppService != null) {
    // The keyword parameter specifies the search keyword.
    miniAppService.queryMiniApps(this, keyword, new OnQueryMiniAppsListener() {
        @Override
        public void onSuccess(List<MiniAppInfo> miniAppInfos, String anchor) {
            // Return the search results. By default, a maximum of 10 miniapps can be obtained. The anchor parameter is used to obtain more miniapps.
        }

        @Override
        public void onFailed(int errorCode) {

        }
    });
}

Start a miniapp

You can start a miniapp by using its ID. WindVane miniapps and uni-app miniapps can be started in the same manner. Loading a miniapp requires a specific period of time. We recommend that you add code to associated callback methods to initialize or update UI elements. The callback methods are called from the UI thread.

import com.alibaba.module.android.mini.app.api.MiniAppOpenConfiguration;
import com.alibaba.module.android.mini.app.api.OnOpenMiniAppListener;
import com.alibaba.module.android.mini.app.api.IMiniAppService;

private void openMiniApp(String miniAppId) {

    IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
    if (miniAppService != null) {
        MiniAppOpenConfiguration config = new MiniAppOpenConfiguration();
        
        miniAppService.openMiniApp(context, miniAppId, config, new OnOpenMiniAppListener() {
  
            @Override
            public void onOpenMiniApp() {
              // You can implement this method to show a loading indicator on the UI when the miniapp starts to load.
            }
        
            @Override
            public void onOpenSuccess(String appId) {
              // You can implement this method to hide the loading indicator on the UI when the miniapp is started.
            }
        
            @Override
            public void onOpenFailed(String appId, int errorCode) {
              // You can implement this method to hide the loading indicator on the UI when the miniapp fails to be started.
            }
        });
    }


}

Open a specific page within a miniapp

When you start a miniapp, you can configure the path parameter to open a specific page within the miniapp and use extraData to pass arguments to the page.

Note
  • For a uni-app miniapp, the path parameter specifies the absolute URL of the miniapp page and extraData is a JSON object used to pass startup arguments to the miniapp. After the miniapp is started, you can retrieve values from extraData by using the plus.runtime.arguments method.

  • To open a page within a WindVane miniapp, you can access a URL in the following format: https://{appId}.app.mini.windvane.suite.emas.alibaba.com/index.html#/{path}?key=value&key2=123. When you develop miniapps, you must use hash routing to handle the logic of page navigation.

MiniAppOpenConfiguration config = new MiniAppOpenConfiguration();
config.path = "/test";
JSONObject arguments = new JSONObject();
arguments.put("MSG","Hello miniApp");
config.extraData = arguments;

IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
if (miniAppService != null) {
  miniAppService.openMiniApp(v.getContext(), "151160916074102445****", config, new OnOpenMiniAppListener() {
  //151160916074102445**** indicates the ID of the miniapp, which is obtained from Application Open Platform. 
    @Override
    public void onOpenMiniApp() {
      // You can implement this method to show a loading indicator on the UI when the miniapp starts to load.
    }

    @Override
    public void onOpenSuccess(String appId) {
      // You can implement this method to hide the loading indicator on the UI when the miniapp is started.
    }

    @Override
    public void onOpenFailed(String appId, int errorCode) {
      // You can implement this method to hide the loading indicator on the UI when the miniapp fails to be started.
    }
  });
}

Preview a MiniApp

By using the "miniapp ID" and "publishId", you can preview the miniapp. Generally, preview parameters are obtained by scanning the QR Code on an Open Platform, and then the preview is started referring to the following example code.

import com.alibaba.module.android.mini.app.api.MiniAppOpenConfiguration;
import com.alibaba.module.android.mini.app.api.OnOpenMiniAppListener;
import com.alibaba.module.android.mini.app.api.IMiniAppService;

private void previewMiniApp(String miniAppId) {

  IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
  if (miniAppService != null) {
  
    MiniAppOpenConfiguration config = new MiniAppOpenConfiguration();
    miniAppService.previewMiniApp(context, "151160916074102445****", "P79127424345890****", config, new OnOpenMiniAppListener() {
      
      // 151160916074102445****:  MiniApp ID
      // P79127424345890****:     publishid
      
      @Override
      public void onOpenMiniApp() {
        // Start previewing the miniapp, 
        // loading prompt can be displayed on the UI
      }
  
      @Override
      public void onOpenSuccess(String appId) {
        // Preview mini program successful, 
        // loading prompt can be hidden on UI
      }
  
      @Override
      public void onOpenFailed(String appId, int errorCode) {
        // Preview mini program failed, 
        // loading prompt can be hidden on UI
      }
    });
  }
}

Fetch Mini-App List Within a Category

The mini-app container SDK offers an interface for fetching a list of mini-apps within a specific category.

IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
if (miniAppService != null) {
  miniAppService.queryMiniAppCategories(context, new OnQueryMiniAppCategoryListener() {
    @Override
    public void onSuccess(List<MiniAppCategory> miniAppCategories) {
       // Displays the list of mini-apps within a single category.
    }

    @Override
    public void onFailed(int errorCode, String errorMsg) {
      
    }
  });
}

Preload Mini App Package

The mini-app container SDK provides an interface for preloading mini-app package.

Method:

void preloadMiniApp(Context context, String appId, MiniAppOpenConfiguration config, OnPreloadMiniAppListener listener)

Parameters:

Parameter

Type

Description

context

Context

Android context

miniAppId

String

Mini app ID

config

MiniAppOpenConfiguration

Configuration for the mini app

listener

OnPreloadMiniAppListener

Callback interface for preloading results

Usage Example:


import com.alibaba.module.android.mini.app.api.MiniAppOpenConfiguration;
import com.alibaba.module.android.mini.app.api.OnPreloadMiniAppListener;
import com.alibaba.module.android.mini.app.api.IMiniAppService;

private void preloadMiniApp(String miniAppId) {

    IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
    if (miniAppService == null) {
        return;
    }
    
    MiniAppOpenConfiguration config = new MiniAppOpenConfiguration();
    
    // If you plan to preload a Uni Mini App, specify the "UniApp" type:
    // config.miniAppType = MiniAppType.UniApp;
    
    miniAppService.preloadMiniApp(context, miniAppId, config, new OnPreloadMiniAppListener() {
        @Override
        public void onPreloadSuccess(String appId) {
            Log.i("PreloadMiniApp", "Mini App preload success");
        }
    
        @Override
        public void onPreloadFailed(String appId, int errorCode) {
            Log.i("PreloadMiniApp", "Mini App preload failed");
        }
    });
}

Get Cache Information of All Mini apps in the Current Container

Method:

List<Map<String, String>> getMiniAppPkgInfoList(Context context)

Parameters:

Parameter

Type

Description

context

Context

Android context

Return result:
A list of Map<String, String> objects, where each map contains cache metadata for one mini app. The map includes the following keys:

Key

Value Type

Description

mini_app_id

String

Mini app ID

mini_app_name

String

Mini app name

cache_size

String

Size of the cached mini app package (in bytes)

cache_version

String

Version of the cached mini app package

create_time

String

Creation time of the cached package (format: yyyy-MM-dd HH:mm:ss

)

last_access_time

String

Last access time of the cached package (format: yyyy-MM-dd HH:mm:ss

)

preload_pkg_size

String

Size of the preloaded package (in bytes)

preload_pkg_version

String

Version of the preloaded package

Usage Example:

import com.alibaba.module.android.mini.app.api.IMiniAppService;

private void getMiniAppCacheInfo() {
    IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
    if (miniAppService == null) {
        return;
    }

    List<Map<String, String>> miniAppPkgInfoList = miniAppService.getMiniAppPkgInfoList(getContext());
}

Sample Output:

[
  {
    "mini_app_id": "1512008766390152499200",
    "mini_app_name": "AI Search",
    "cache_size": "4096",
    "cache_version": "0.0.26",
    "create_time": "2026-01-21 16:38:54",
    "last_access_time": "2026-01-21 16:38:54",
    "preload_pkg_size": "4096",
    "preload_pkg_version": "0.0.26"
  },
  ...
]

Delete Specified Mini app Caches from the Current Container

Method:

boolean removeMiniAppPackages(Context context, List<String> ids)

Parameters:

Parameter

Type

Description

context

Context

Android context

ids

List<String>

List of mini app IDs to delete

Return result:

  • true: All specified mini app caches were successfully deleted.

  • false: At least one mini app cache failed to be deleted.

Usage Example:

import com.alibaba.module.android.mini.app.api.IMiniAppService;

public void removeMiniAppPkgs(List<String> ids) {
    if (ids == null || ids.isEmpty()) {
        return;
    }

    IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
    if (miniAppService == null) {
        return;
    }

    boolean success = miniAppService.removeMiniAppPackages(getContext(), ids);
}

Mini app Download Statistics

Observer Interface Definition:

public interface IDownloadStatsObserver extends IBaseObserve {
    void onMiniAppDownloadSuccess(Map<String, Object> result);
    void onMiniAppDownloadFailed(Map<String, Object> result);
}

Callback Parameters:

Key

Value Type

Description

mini_app_id

String

Mini app ID

mini_app_version

String

Mini app version

Usage Example:


import com.alibaba.module.android.mini.app.api.IMiniAppService;

private void registerObserver() {
    IMiniAppService miniAppService = ServiceManager.getInstance().getService(IMiniAppService.class.getName());
    if (miniAppService == null) {
        return;
    }

    miniAppService.registerServiceObserver(new IDownloadStatsObserver() {
        @Override
        public void onMiniAppDownloadSuccess(Map<String, Object> result) {
            Log.i("DownloadObserver", "Mini App download success");
        }

        @Override
        public void onMiniAppDownloadFailed(Map<String, Object> result) {
            Log.i("DownloadObserver", "Mini App download failed");
        }
    });
}