In the era of “national creation”, digital “We Media” has many ways of realization, allowing more and more people to participate in content creation. However, where there is originality, there is plagiarism! How to prevent piracy and protect the legitimate rights and interests of creators has drawn the unanimous attention of national regulators, creation platforms and creators. Huawei has cooperated with China Copyright Center to launch DCI copyright service, which utilizes blockchain and big data technology to protect the copyright of digital works, and provides DCI copyright service user registration, DCI registration, DCI authorization, and DCI rights protection service capabilities. DCI successfully registered digital works information (including DCI code) will be stored in the blockchain, to ensure that all copyright information is reliable and traceable. Anytime and anywhere for each creator to provide peace of mind copyright protection.

Effect of the sample

Creators in digital works after registration of DCI China copyright protection center according to certain program will corresponding works copyright or copyright-related rights information put on record, and assign the DCI code, through huawei since the grinding block chain, big data, such as technical blessing, fast and efficient service to help creators get rid of the cumbersome approval process to complete the copyright certification, Finally, the copyright value of the works can be maximized.

The development of preparation

1. Configure the integrated SDK package

Add SDK dependencies of DCI copyright services to Dependencies in the application’s build.gradle file

/ / the DCI Kit SDK iimplementation 'com. Huawei. HMS: DCI: 3.0.1.300'

2. Configuration AndroidManifest. XML

Open the AndroidManifest. XML file in the main folder, you can configure read and write phone storage and camera permissions according to the needs of the scene and use, and add them before <application>

<! --> <uses-permission android:name="android.permission. Write_external_storage "/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <! - INTERNET access - > < USES - permission android: name = "android. Permission. INTERNET" / >

Development steps

1. Initialize DCI SDK·

In the onCreate() method of the Application, the DCI SDK is initialized.

@Override
public void onCreate() {
    super.onCreate();
    // Init DCI Kit
    HwDciPublicClient.initApplication(this);
}

2. Users of non-DCI copyright service should register first.

// Get OpenID and AccesToken AccountAuthParams authParams = new through the Huawei account service AccountAuthParamsHelper(AccountAuthParams.DEFAULT_AUTH_REQUEST_PARAM) .setAccessToken() .setProfile() .createParams(); AccountAuthService service = AccountAuthManager.getService(activity, authParams); Task<AuthAccount> mTask = service.silentSignIn(); mTask.addOnSuccessListener(new OnSuccessListener<AuthAccount() { @Override public void onSuccess(AuthAccount String hmsOpenID = AuthAccounts. GetOpenID (); / / to get huawei account AccessToken String hmsAccessToken = authAccount. GetAccessToken (); }}); // Set SDK method ParaminInfoEntity ParaminInfoEntity = new ParaminInfoEntity (); / / to huawei application developer alliance AppGallery Connect AppID paramsInfoEntity. SetHmsAppId (hmsAppId); / / to huawei account OpenID paramsInfoEntity. SetHmsOpenId (hmsOpenId); / / hmsPushToken for integration of huawei's push function provided by the token, if this value is not integrated push function is not paramsInfoEntity. SetHmsPushToken (hmsPushToken); / / to huawei account AccessToken paramsInfoEntity. SetHmsToken (hmsAccessToken); Int myRequestCode = 1; int myRequestCode = 1; int myRequestCode = 1; / / start DCI copyright service user registration screen HwDciPublicClient. RegisterDciAccount (activity, paramsInfoEntity myRequestCode); // After the user registration of DCI copyright service is completed, the user registration result of DCI copyright service can be obtained in the OnActivityResult of the page. @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode ! = myRequestCode || resultCode ! = RESULT_OK || data == null) { return; } int code = data.getIntExtra(HwDciConstant.DCI_REGISTER_RESULT_CODE, 0); If (code == 200) {// DCI UID AccountinFoEntity AccountinFoEntity = data.getParcelableExtra(HwDciConstant.DCI_ACCOUNT_INFO_KEY); String dciUid = accountInfoEntity.getUserId(); } else {// DCI copyright service user registration failed, according to code handle failed logic}}

3. Incoming works shall be registered with DCI

ApplyDCICODE interface of HWDCIPublicClient is called, and relevant information of the digital works is passed into it for DCI registration.

// Initializing the Rebuild Engine ParamsInfoEntity paramsInfoEntity = new ParamsInfoEntity(); paramsInfoEntity.setDciUid(dciUid); paramsInfoEntity.setHmsAppId(hmsAppId); paramsInfoEntity.setHmsOpenId(hmsOpenId); paramsInfoEntity.setHmsToken(hmsToken); / / to get digital works locally saved path String imageFilePath = imageFile. GetAbsolutePath (); String local = "Beijing "; String local =" Beijing "; Long currentTime = system.currentTimeMillis (); long currentTime = system.currentTimeMillis (); / / call interface methods HwDciPublicClient. ApplyDciCode (paramsInfoEntity imageFilePath, local, currentTime, New HWDCIClientCallback <String bb0 () {@Override public void onSuccess(String workId) {// Override public void onSuccess(String workId) {// Override public void onSuccess(String workId) { Used to query for DCI registration result entry. } @Override public void onFail(int code, String MSG) {// DCI submission failed. }});

4. Query DCI registration results.

Call the queryWorkDciInfo interface of HWDCIPublicClient, and judge the DCI registration result according to the returned status code. If the registration is successful, get the DCI code assigned to the work.

ParamsInfoEntity paramsInfoEntity = new ParamsInfoEntity(); paramsInfoEntity.setDciUid(dciUid); paramsInfoEntity.setHmsAppId(hmsAppId); paramsInfoEntity.setHmsOpenId(hmsOpenId); paramsInfoEntity.setHmsToken(hmsToken); paramsInfoEntity.setWorkId(workId); HwDciPublicClient.queryWorkDciInfo(paramsInfoEntity, new HwDciClientCallBack<WorkDciInfoEntity>() { @Override public void onSuccess(WorkDciInfoEntity result) { if (result ==  null) { return; } / / according to the results of the return a status code to judge the DCI registration 0 on behalf of processing, 1 represents success, 2 representative failure if (result. GetRegistrationStatus () = = 1) {/ / query is successful, the DCI registration is successful, to obtain the DCI yards. mDciCode = result.getDciCode(); } else if (result. GetRegistrationStatus () = = 0) {/ / query is successful, the DCI registration is under processing. }else {// The query succeeded, DCI registration failed. Obtain the reason for failure of DCI registration. Public void onFail(int code, String MSG) {public void onFail(int code, String MSG) {public void onFail(int code, String MSG); }});

5. Add DCI labels for digital works.

Call the AddDciWaterMark interface of HWDCIPublicClient to add DCI label to the works registered successfully by DCI, which is used as the copyright confirmation mark of digital works

/ / to need to add the DCI the digital works of mark's local path String imageFilePath = imageFile. GetAbsolutePath (); HwDciPublicClient.addDciWatermark(imageFilePath, New HWDCIClientCallback <String bb0 () {@Override public void onSuccess(String ImageBase64String) {// DCi = new HWDCIClientCallback <String bb0 (); } @Override public void onFail(int code, String MSG) {// Fail to add}}); Override public void onFail(int code, String MSG) {// Fail to add}});

Learn more about it

Visit the official website of Huawei DCI copyright service

Obtain Huawei DCI copyright service development guidance document

Address of Huawei DCI copyright service open source repository: GitHub and Gitee

Huawei HMS Core Official Forum

To solve integration problems, go to Stack Overflow

Click the attention on the upper right corner of the image to get to know the latest HMS Core technology in the first time

This article by the blog multiple platform
OpenWriteRelease!