The mini program SDK provides an API for searching mini programs online by keywords and categories.
API description:
Note:
The SearchOptions parameter is used to specify the keywords and category information for the mini program search.
The MiniCallback parameter is used to obtain the search results of the mini program.
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 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 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) {
}else{
}
}
});
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) {
}else{
}
}
});
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:
SearchOptions searchOptions = new SearchOptions("keyword", MiniEngineType.MiniGame, "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) {
}else{
}
}
});