tencent cloud

Tencent Cloud Super App as a Service

Searching Mini Programs

PDF
Focus Mode
Font Size
Last updated: 2025-07-04 16:48:08
The mini program SDK provides an API for online mini program searches, allowing you to search for mini programs by keywords and categories.
API description:
Note:
SearchOptions parameter is used to specify the keywords and category information for the mini program search.
MiniCallback parameter is used to retrieve the search results for the mini programs.
/**
* Mini program search
*
* @param searchOptions
* @param callback
*/
public static void searchMiniApp(SearchOptions searchOptions, MiniCallback<List<MiniApp>> callback)

Search by keyword

Example:
SearchOptions searchOptions = new SearchOptions("yourkeyword");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
// Search successful, list is not empty
}else{
// Search failed, or the list is empty
}
}
});

Search by a single category

Example:
SearchOptions searchOptions = new SearchOptions("","Category name","");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
// Search successful, list is not empty
}else{
// Search failed, or the list is empty
}
}
});

Search by dual categories

Note:
The result will be the intersection of the two categories.
Example:
SearchOptions searchOptions = new SearchOptions("","Category name","Category name 2");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
// Search successful, list is not empty
}else{
// Search failed, or the list is empty
}
}
});

Search by keyword and categories

Note:
Search by both keyword and categories, and the result will be the intersection of the keyword and category.
Example:
SearchOptions searchOptions = new SearchOptions("keyword","Category name","Category name 2");
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
// Search successful, list is not empty
}else{
// Search failed, or the list is empty
}
}
});

Specify search for mini programs or mini games

Note:
Starting from SDK version 2.2.0, the search API supports specifying whether to search for mini games or mini programs. By default, it searches both.
Example:
// Specify search for mini games
SearchOptions searchOptions = new SearchOptions("keyword", "Category name", "Category name 2");
searchOptions.engineType = MiniEngineType.MiniGame;
TmfMiniSDK.searchMiniApp(searchOptions, new MiniCallback<List<MiniApp>>() {
@Override
public void value(int code, String msg, List<MiniApp> data) {
if (code == MiniCode.CODE_OK && data != null) {
// Search successful, list is not empty
}else{
// Search failed, or the list is empty
}
}
});

Paginated search

Note:
Starting from SDK version 2.2.4, paginated search is supported. Pagination parameters are configured using SearchOptions. The paginated list and the total number of matched mini programs are returned by SearchResult.
Example:
SearchOptions searchOptions = new SearchOptions("keyword", "Category name", "Category name 2");
searchOptions.pageIndex = index; // Page number
searchOptions.pageSize = size; // Page size
TmfMiniSDK.searchMiniApp2(searchOptions, new MiniCallback<SearchResult>() {
@Override
public void value(int code, String msg, SearchResult data) {
if (code == MiniCode.CODE_OK && data != null && data.miniAppList != null) {
// Search successful, list is not empty
//data.total: Total number of matched mini programs, can be used to calculate the number of pages
//data.miniAppList: List of mini programs on the current page
} else {
// Search failed, or the list is empty
}
}
});



Help and Support

Was this page helpful?

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

Feedback