Customize predefined more menu items
The super app can customize the icon, title, and row layout of the SDK's predefined more menu items. These items include:
- Favorite/Unfavorite: Allows users to add or remove the mini program from their favorites.
- Notification: Allows users to view notifications.
- Subscription: Allows users to view subscriptions.
- Feedback: Allows users to submit feedback.
- Settings: Allows users to view and modify the mini program settings.
- About: Allows users to view the mini program information.
- Share: Allows users to share the mini program.
- Reopen: Allows users to reopen the mini program.
To customize these menu items, the super app must implement the MenuInfoExtension interface. This topic covers the default user experience, implementation steps, and interface details.
Note:
- Menu item availability depends on the super app's integrated modules.
- If you need to fully control the more menu, implement the
GriverMenuExtensionImplinterface. This interface provides the following capabilities:
- Control the visibility of menu items
- Add custom menu items
- Customize the appearance of menu items
- Handle click events of menu items
For implementation details, refer to Customize the more menu.
Typically, the super app implements either the
MenuInfoExtensioninterface or theGriverMenuExtensionImplinterface. If you implement both and conflicts occur, theGriverMenuExtensionImplimplementation takes precedence.
Default user experience
The following image shows the default icon, title, and row layout of each menu item:

Before you begin
To customize predefined more menu items, ensure that the integrated Android IAPMiniProgram SDK is version 2.65.7 or later. For more information, see SDK release notes.
Procedure
To customize predefined more menu items, take the following two steps:
Step 1: Implement the MenuInfoExtension interface
Create a class that implements the MenuInfoExtension interface. Within the class, override the getMenuInfo method to customize predefined more menu items. Refer to the following code for a sample implementation. For more information about the interface and the method, refer to MenuInfoExtension.
class MenuInfoExtensionImpl : MenuInfoExtension {
override fun getMenuInfo(type: String, status: String): MenuItemInfo {
var itemInfo: MenuItemInfo? = null
when (type) {
MenuInfoExtension.MenuType.TYPE_COLLECT -> itemInfo =
if (TextUtils.equals(MenuInfoExtension.MenuStatus.STATUS_COLLECT_OFF, status)) {
// Create and return MenuItemInfo
} else {
// Create and return MenuItemInfo
}
MenuInfoExtension.MenuType.TYPE_NOTIFICATION ->
// Create and return MenuItemInfo
//···
}
return itemInfo!!
}
}Step 2: Register the implementation class
After initializing the SDK, call the registerExtension API to register the implementation class (for example, MenuInfoExtensionImpl in the sample) with the SDK. Refer to the following sample registration code:
IAPConnect.init(application, initConfig, object : InitCallback {
override fun onSuccess() {
//···
Griver.registerExtension(
GriverExtensionManifest(
MenuInfoExtension::class.java,
MenuInfoExtensionImpl()
)
)
}
})Structure
MenuInfoExtension interface
The MenuInfoExtension interface defines a method for the super app to customize predefined more menu items. The SDK then calls this method to retrieve the custom configuration for rendering the more menu. Refer to the following code for the interface definition:
interface MenuInfoExtension : GriverExtension {
@StringDef(
MenuInfoExtension.MenuType.TYPE_COLLECT,
MenuInfoExtension.MenuType.TYPE_NOTIFICATION,
MenuInfoExtension.MenuType.TYPE_SUBSCRIBE,
MenuInfoExtension.MenuType.TYPE_FEEDBACK,
MenuInfoExtension.MenuType.TYPE_SETTING,
MenuInfoExtension.MenuType.TYPE_ABOUT,
MenuInfoExtension.MenuType.TYPE_SHARE,
MenuInfoExtension.MenuType.TYPE_REOPEN
)
annotation class MenuType {
companion object {
const val TYPE_COLLECT: String = "MoreMenuCollect"
const val TYPE_NOTIFICATION: String = "MoreMenuNotification"
const val TYPE_SUBSCRIBE: String = "MoreMenuSubscribe"
const val TYPE_FEEDBACK: String = "MoreMenuFeedback"
const val TYPE_SETTING: String = "MoreMenuSetting"
const val TYPE_ABOUT: String = "MoreMenuAbout"
const val TYPE_SHARE: String = "MoreMenuShare"
const val TYPE_REOPEN: String = "MoreMenuReopen"
}
}
@StringDef(
MenuInfoExtension.MenuStatus.STATUS_NONE,
MenuInfoExtension.MenuStatus.STATUS_COLLECT_ON,
MenuInfoExtension.MenuStatus.STATUS_COLLECT_OFF
)
annotation class MenuStatus {
companion object {
const val STATUS_NONE: String = ""
const val STATUS_COLLECT_ON: String = "MoreMenuCollect_On"
const val STATUS_COLLECT_OFF: String = "MoreMenuCollect_Off"
}
}
fun getMenuInfo(
@MenuInfoExtension.MenuType type: String,
@MenuInfoExtension.MenuStatus status: String
): MenuItemInfo?
}Based on the definition, this interface provides the following methods:
Method | Description |
getMenuInfo | Called by the SDK to retrieve the custom configuration of a specific menu item. For more information, refer to |
getMenuInfo method
Parameters
The getMenuInfo method has the following input parameters:
Parameter | Data type | Required | Description |
type | String | Yes | The specific menu item. Valid values are:
|
status | String | Yes | The item state. Valid values are:
|
Return value
The method returns a MenuItemInfo object, which contains the following parameters for the super app to customize the menu item:
Parameter | Data type | Required | Description |
title | String | Yes | The title of the menu item. |
iconDrawable | Int | Yes | The icon's drawable resource ID for light mode. |
iconDrawableNight | Int | Yes | The icon's drawable resource ID for dark mode. |
rowEnum | MenuRowEnum | No | The row layout of the menu item. Valid values are:
If not specified, the menu item is placed in its default row as illustrated in Default user experience. Note:
|