1. Cloud Service BizBundle

Tuya smart cameras provide cloud storage video services, and cloud storage services can be activated through this bizBundle. After active cloud storage service, you can view and play cloud storage videos through Tuya Smart Camera SDK.

1.1. Integrated BizBundle

  1. Access service package framework
  2. Cloud storage service is strongly related to account, and needs to integrate graffiti cloud user management. Refer to integrated document
  3. Configure build.gradle in the module directory
dependencies {
        implementation 'com.tuya.smart:tuyasmart-bizbundle-cloud_storage:3.22.0-6'
}

1.2. Function

1.2.1. Start cloud service purchase activity

Declaration

Jump to the cloud storage purchase H5 page

Cloud storage services are strongly associated with user systems. Therefore, it needs to be called after use login.

public void buyCloudStorage(Context mContext, DeviceBean deviceBean, String homeId, AbsCloudCallback callback);

Parameters

Parameter Description
context context
deviceBean device info
homeId The family ID is obtained through the home SDK interface
callback callback when error

Example

findViewById(R.id.buy_btn).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
    //get service
    AbsCameraCloudPurchaseService cameraCloudService = MicroServiceManager.getInstance().findServiceByInterface(AbsCameraCloudPurchaseService.class.getName());
    if (cameraCloudService != null) {
      cameraCloudService.buyCloudStorage(CameraCloudStorageActivity.this,
                                         TuyaHomeSdk.getDataInstance().getDeviceBean(devId),
                                         String.valueOf(FamilyManager.getInstance().getCurrentHomeId()), new AbsCloudCallback() {
                                           @Override
                                           public void onError(String errorCode, String errorMessage) {
                                             super.onError(errorCode, errorMessage);
                                           }
                                         });
    }
  }
});

1.2.2. Release resource

Example

Jumping to the cloud storage purchase page involves time-consuming operations such as network requests, so resources need to be released when the called page is destroyed.

public void destroy();

Example

@Override
protected void onDestroy() {
  super.onDestroy();
  AbsCameraCloudPurchaseService cameraCloudService = MicroServiceManager.getInstance().findServiceByInterface(AbsCameraCloudPurchaseService.class.getName());
  if (cameraCloudService != null) {
      cameraCloudService.destroy();
  }
}

results matching ""

    No results matching ""