Home Management UI BizBundle

Last Updated on : 2024-01-22 07:07:13download

Home Management UI BizBundle is used to implement features such as management of homes, members, and rooms. It provides the basis to manage paired devices. Each home is the maximum scope in which smart scenes can be run.

Users can assign rooms to devices for homes. Home members can be granted different permissions on preferred operations.

Integrate with the UI BizBundle

Create a project

Integrate Smart Life App SDK for Android into your project with Android Studio and add the framework of the UI BizBundle to your project. For more information, see Integrate with Framework.

Configure build.gradle of module

dependencies {
    api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:5.8.5")
    api "com.thingclips.smart:thingsmart-bizbundle-family"

    api "com.thingclips.smart:thingsmart:5.8.0"
}

Implement features

Access the home management page

Navigates to the home management page through the route implemented by the following method:

UrlRouter.execute(UrlRouter.makeBuilder(FamilyManageActivity.this, "family_manage"));

Accept or decline an invitation to join a home

The logic to process a home invitation is not supported by the UI BizBundle. You can implement this logic on your app homepage or other phases in which you want to process the invitation.

Home invitation messages are sent over MQTT. Therefore, the Home Management UI BizBundle provides the following methods to listen for home invitation messages:

// Registers a listener.
ThingHomeSdk.getHomeManagerInstance()
    .registerThingHomeChangeListener(HomeInviteListener listener);
// Unregisters a listener.
ThingHomeSdk.getHomeManagerInstance()
    .unRegisterThingHomeChangeListener(HomeInviteListener listener);

Example:

ThingHomeSdk.getHomeManagerInstance()
    .registerThingHomeChangeListener(new HomeInviteListener() {
        @Override
        public void onHomeInvite(long homeId, String homeName) {
            // accept or reject invitation from this family
                ThingHomeSdk.getMemberInstance()
                .processInvitation(homeId, isAccept, new IResultCallback() {
                    @Override
                    public void onError(String errorCode, String errorMsg) {

                    }

                    @Override
                    public void onSuccess() {
                        // Do something like refresh family list
                    }
                    });
        }
    });