Home Management UI BizBundle

Last Updated on : 2023-05-22 06:38:25download

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.

Configure build.gradle of module

dependencies {
	implementation 'com.tuya.smart:tuyasmart-bizbundle-family:1.0.0-cube'
}

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.
TuyaHomeSdk.getHomeManagerInstance()
	.registerTuyaHomeChangeListener(HomeInviteListener listener);
// Unregisters a listener.
TuyaHomeSdk.getHomeManagerInstance()
	.unRegisterTuyaHomeChangeListener(HomeInviteListener listener);

Example:

TuyaHomeSdk.getHomeManagerInstance()
	.registerTuyaHomeChangeListener(new HomeInviteListener() {
		@Override
		public void onHomeInvite(long homeId, String homeName) {
			// Accepts or rejects an invitation from this home.
				TuyaHomeSdk.getMemberInstance()
				.processInvitation(homeId, isAccept, new IResultCallback() {
					@Override
					public void onError(String errorCode, String errorMsg) {

					}

					@Override
					public void onSuccess() {
						// Do something like refreshing the home list.
					}
					});
		}
	});