Native Control Panel for Switch

Last Updated on : 2023-03-09 08:08:56

Native control panels for switches are developed based on native code and support all switch categories.


  • Lightweight and free of frameworks such as React Native.
  • Support all switch categories and apply to new products without app launching.
  • Facilitate debugging during development.

    Native Control Panel for SwitchNative Control Panel for SwitchNative Control Panel for Switch

How it works


implementation ''

API description

void openDefaultPanel(Context context, String devId, MenuBean menuBean);


Parameter Description
context The context to start an activity.
devId The device ID.
menuBean Creates and displays custom menus and events.

menuBean can be set to null if it is not required.

MenuBean data model

Field Data type Description
menuRes int The ID of a custom menu resource.
menuItemId int The value of itemId for the custom menu.
bundle Bundle The Bundle that passes custom data. You can use IDefaultPanelController.BUNDLE_KEY to get the value from Intent.
activityClassName String The value of ClassName for a custom activity. Example: TestActivity.class.getName().

Java example

MenuBean menuBean = new MenuBean();
Bundle bundle = new Bundle();
bundle.putString("DEV_ID_KEY", devId);
IDefaultPanelController defaultPanelController = PluginManager.service(IDefaultPanelController.class);
defaultPanelController.usePanel(new HomeSDKPanel());
defaultPanelController.openDefaultPanel(context, devId, menuBean);
  • Native control panels use startActivityForResult(Intent, IDefaultPanelController.REQUEST_CODE_DEFAULT_PANEL) to start a custom activity.
  • Under onActivityResult, the application disables native control panels if (requestCode == IDefaultPanelController.REQUEST_CODE_DEFAULT_PANEL && resultCode == RESULT_OK) is true.