Value-Added Services v1.0

Last Updated on : 2024-10-31 08:27:41download

Value-added services v1.0 use H5 pages. It is strongly recommended that you upgrade to v2.0 and choose the miniapp page. H5 pages will no longer be iterated in the future.

Please upgrade to the latest value-added service plan.

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 enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:${biz_bom_version}")
        api "com.thingclips.smart:thingsmart-bizbundle-cloud_storage"
        api "com.thingclips.smart:thingsmart:${sdk_version}}"
    }
    
    

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();
	}
}