Cloud Storage UI BizBundle

Last Updated on : 2023-07-03 03:04:43download

Powered by Tuya (PBT) IP cameras (IPCs) support cloud-based storage of video data from the IPCs. You can integrate with Cloud Storage UI BizBundle and allow users to subscribe to the Cloud Storage for Videos service. Then, they can view and play cloud-stored video footage based on the IPC SDK.

Integrate with the UI BizBundle

  1. Integrate with the framework of the UI BizBundle.

  2. The Cloud Storage for Videos service is strongly correlated with user information. Therefore, user management features must be implemented. For more information, see User Account Management.

  3. Add the following dependency to the file build.gradle of·module:

    dependencies {
    	api 'com.thingclips.smart:thingsmart-bizbundle-cloud_storage:2.0.0-cube.2'
    }
    

Implement features

Navigate to the subscription page

API description

The Cloud Storage for Videos service is strongly correlated with user information. Therefore, the navigation can be enabled as expected only when the user has logged in to the app.

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

Parameters

Parameter Description
context The context.
deviceBean The information about the device.
homeId The home ID.
callback The failure callback.

Example

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

Release resources

Releases resources consumed for navigation to the service purchase page during the call of destroying the page. API requests and other time-consuming operations are processed in the navigation.

API description

public void destroy();

Example

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