1. House Management
1.1. Features
The family biz bundle mainly includes business such as family, member, room, etc., which are the basic conditions for the management of the devices after devices are activated. The device can set the room where the device is located in the family after the device configuration, meanwhile, the family members who have different authority under the family correspond to different operation authority, and the family is also the largest unit of scene intelligence execution.
1.2. BizBundle integration
1.2.1. Create project
Create your project in Android Studio, connect to the public SDK and configure Biz Bundle Framework.
1.2.2. Module's build.gradle configuration
dependencies {
implementation 'com.tuya.smart:tuyasmart-bizbundle-family:3.22.0-6'
}
1.3. Function use
1.3.1. Go to Family Management page
The family management page supports redirection through the following routing method:
UrlRouter.execute(UrlRouter.makeBuilder(FamilyManageActivity.this, "family_manage"));
1.3.2. Accept or Refuse To Join the Family
At present, the business of accepting family invitations is not within the scope of biz bundle processing. You can handle this part of the logic on your application homepage or other places where you want to receive family invitations. Since messages for family invitations are sent down via MQTT push, the Family biz bundle provides the following methods to listen for family invitation notifications.
// register listener
TuyaHomeSdk.getHomeManagerInstance()
.registerTuyaHomeChangeListener(FamilyInstance.getInstance().getInviteListener());
// unregister listener
TuyaHomeSdk.getHomeManagerInstance()
.unRegisterTuyaHomeChangeListener(FamilyInstance.getInstance().getInviteListener());
getInviteListener
has implemented the pop-up style family invitation logic for you by default internally, or you can implement it yourself in the following way:
TuyaHomeSdk.getHomeManagerInstance()
.registerTuyaHomeChangeListener(new HomeInviteListener() {
@Override
public void onHomeInvite(long homeId, String homeName) {
// accept or reject invitation from this family
TuyaHomeSdk.getMemberInstance()
.processInvitation(homeId, isAccept, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
}
@Override
public void onSuccess() {
// Do something like refresh family list
}
});
}
});