device-security-kit-sample-code-business-risk-intelligent-detection:基于 HarmonyOS 的业务风险智能检测项目

本示例基于业务风险检测服务能力,提供场景(防作弊、反欺诈、违规内容检测等)的业务风险决策能力。

Branch1Tags0
FilesLast commitLast update
2 years ago
9 months ago
1 year ago
9 months ago
2 years ago
9 months ago
2 years ago
1 year ago
9 months ago
9 months ago

Implement business intelligent risk detection (ArkTS)

Overview

This sample code demonstrates how to use the BusinessRiskIntelligentDetection API in your application for fraud detection, simulated click detection and enhanced simulated click detection.

The API that you need to use is packaged into @kit.DeviceSecurityKit.

Preview

Example effect

How to Configure and Use

Configuring the Sample App in DevEco Studio

  1. Create a project. Under the project, create an app.
  2. Open the sample app and set bundleName in the app.json5 file to the app package name configured in AppGallery Connect.
  3. Enable Fraud detection in AppGallery Connect. For details, please refer to here. No activation is required for Simulated click detection or Enhanced simulated click detection.

Using the Sample App

  1. Before running the sample app, connect the device to the network.

  2. Run the sample app:

    1. Tap FraudRiskDetect to obtain the fraud detection result.
    2. Tap SimulatedClickRiskDetect to obtain the simulated click detection result.
    3. Tap SimulatedClickRiskEnhancedDetect to obtain the enhanced simulated click detection result.

    If the result is obtained successfully, it will be displayed on the page. If the result fails to be obtained, an error code will be displayed on the page.

  3. After obtaining the detection result:

    1. Fraud detection result should be parsed and signature-verified on the server side.
    2. Simulated click detection result should be parsed on the server side.
    3. Enhanced simulated click detection result should be parsed and signature-verified on the server side.

Project Directory

└──entry/src/main/ets            // Code area. 
   └── entryability                    
   │   └── EntryAbility.ets          // Entry point class. 
   └── model                
   │   └── FraudRiskDetectModel.ets    // Class for obtaining the fraud detection result. 
   │   └── SimulatedClickRiskDetectModel.ets    // Class for obtaining the simulated click detection result. 
   |   └── SimulatedClickRiskEnhancedDetectModel.ets    // Class for obtaining the enhanced simulated click detection result.
   └── pages                                     
       └── Index.ets              // Home page, where the business risk detection result can be obtained. 

How to Implement

This demo illustrates how to call the business risk detection functions on a page.

  1. Call the businessRiskIntelligentDetection.detectFraudRisk() method to obtain the fraud detection result. For details, please refer to FraudRiskDetectModel.ets.
  2. Call the businessRiskIntelligentDetection.detectSimulatedClickRisk() method to obtain the simulated click detection result. For details, please refer to SimulatedClickRiskDetectModel.ets.
  3. Call the businessRiskIntelligentDetection.detectSimulatedClickRiskEnhanced() method to obtain the enhanced simulated click detection result. For details, please refer to SimulatedClickRiskDetectModel.ets.

Reference

  1. entry\src\main\ets\entryability\EntryAbility.ets
  2. entry\src\main\ets\model\FraudRiskDetectModel.ets
  3. entry\src\main\ets\model\SimulatedClickRiskDetectModel.ets
  4. entry\src\main\ets\model\SimulatedClickRiskEnhancedDetectModel.ets
  5. entry\src\main\ets\pages\Index.ets

Required Permissions

None

Dependencies

The device where the sample app runs must connect to the network.

Constraints

  1. The sample app is only supported on phones and tablets with standard systems.

  2. The HarmonyOS version must be HarmonyOS 6.0.2 Beta1 or later.

  3. The DevEco Studio version must be DevEco Studio 6.0.2 Beta1 or later.

  4. The HarmonyOS SDK version must be HarmonyOS 6.0.2 Beta1 SDK or later.

Introduction

本示例基于业务风险检测服务能力,提供场景(防作弊、反欺诈、违规内容检测等)的业务风险决策能力。

Customize your domain