目录

SafetyDetectClient

Interface Info

public interface SafetyDetectClient

Main entry for calling Safety Detect APIs.

Public Method Summary

Qualifier and Type

Method Name and Description

com.huawei.hmf.tasks.Task<SysIntegrityResp>

sysIntegrity(byte[] nonce, String appId)

Initiates a request to check the system integrity of the current device.

NOTE:

This method is not recommended. Use sysIntegrity(SysIntegrityRequest sysIntegrityRequest) instead.

com.huawei.hmf.tasks.Task<SysIntegrityResp>

sysIntegrity(SysIntegrityRequest sysIntegrityRequest)

Initiates a request to check the system integrity of the current device.

NOTE:

This method is recommended for version 5.0.5.302 and later.

com.huawei.hmf.tasks.Task<VerifyAppsCheckEnabledResp>

enableAppsCheck()

Enables app security check.

com.huawei.hmf.tasks.Task<VerifyAppsCheckEnabledResp>

isVerifyAppsCheck()

Checks whether app security check is enabled.

com.huawei.hmf.tasks.Task<MaliciousAppsListResp>

getMaliciousAppsList()

Initiates an app security check request.

com.huawei.hmf.tasks.Task<Void>

initUrlCheck()

Initializes URL check.

com.huawei.hmf.tasks.Task<UrlCheckResponse>

urlCheck(String uri, String appId, int... threatTypes)

Initiates a URL check request.

com.huawei.hmf.tasks.Task<Void>

shutdownUrlCheck()

Disables URL check.

com.huawei.hmf.tasks.Task<UserDetectResponse>

userDetection(String appId)

Initiates a fake user detection request.

com.huawei.hmf.tasks.Task<Void>

initUserDetect()

Initializes fake user detection.

com.huawei.hmf.tasks.Task<Void>

shutdownUserDetect()

Disables fake user detection.

com.huawei.hmf.tasks.Task<WifiDetectResponse>

getWifiDetectStatus()

Obtains the malicious Wi-Fi check result.

Public Methods

[h2]sysIntegrity(byte[] nonce, String appId)

Method

Task<SysIntegrityResp> sysIntegrity(byte[] nonce, String appId)

Initiates a request to check the system integrity of the current device.

Parameters

Name

Description

nonce

Cryptographic nonce value, which is used to prevent replay attacks. Ensure that the nonce value passed each time when the sysIntegrity API is called is unique. A nonce value must consist of 16 to 66 bytes.

appId

App ID applied on HUAWEI Developers. HMS Core (APK) needs to authenticate the app ID. You need to enable the Safety Detect service for the app with this ID on the Manage APIs page in AppGallery Connect.

Returns

Type

Description

Task<SysIntegrityResp>

System integrity check result.

[h2]sysIntegrity(SysIntegrityRequest sysIntegrityRequest)

Method

Task<SysIntegrityResp> sysIntegrity(SysIntegrityRequest sysIntegrityRequest)

Initiates a request to check the system integrity of the current device.

Parameters

Name

Description

sysIntegrityRequest

Request entity class of the SysIntegrity API.

Returns

Type

Description

Task<SysIntegrityResp>

System integrity check result.

[h2]enableAppsCheck

Method

Task<VerifyAppsCheckEnabledResp> enableAppsCheck()

Enables app security check.

Returns

Type

Description

Task<VerifyAppsCheckEnabledResp>

Result of enabling app security check.

[h2]isVerifyAppsCheck

Method

Task<VerifyAppsCheckEnabledResp> isVerifyAppsCheck()

Checks whether app security check is enabled.

Returns

Type

Description

Task<VerifyAppsCheckEnabledResp>

Whether app security check is enabled.

[h2]getMaliciousAppsList

Method

Task<MaliciousAppsListResp> getMaliciousAppsList()

Initiates an app security check request.

Returns

Type

Description

Task<MaliciousAppsListResp>

App security check result.

[h2]initUrlCheck

Method

Task<Void> initUrlCheck()

Initializes URL check.

[h2]urlCheck

Method

Task<UrlCheckResponse> urlCheck(String url, String appId, int... threatTypes)

Initiates a URL check request.

Parameters

Name

Description

url

URL to check, including the protocol, host, and path but excluding query parameters. The SDK will discard all passed query parameters.

appId

App ID applied on HUAWEI Developers. HMS Core (APK) needs to authenticate the app ID. You need to enable the Safety Detect service for the app with this ID on the Manage APIs page in AppGallery Connect.

threatTypes

Concerned threat types for URLs to check. For details about threat types, please refer to UrlCheckThreat.

Returns

Type

Description

Task<UrlCheckResponse>

URL check result.

[h2]shutdownUrlCheck

Method

Task<Void> shutdownUrlCheck()

Disables URL check.

[h2]userDetection

Method

Task<UserDetectResponse> userDetection(String appId)

Initiates a fake user detection request.

Parameters

Name

Description

appId

App ID applied on HUAWEI Developers. HMS Core (APK) needs to authenticate the app ID. You need to enable the Safety Detect service for the app with this ID on the Manage APIs page in AppGallery Connect.

Returns

Type

Description

Task<UserDetectResponse>

Result of fake user detection.

[h2]initUserDetect

Method

Task<Void> initUserDetect()

Initializes fake user detection.

[h2]shutdownUserDetect

Method

Task<Void> shutdownUserDetect()

Disables fake user detection.

[h2]getWifiDetectStatus

Method

Task<WifiDetectResponse> getWifiDetectStatus()

Obtains the malicious Wi-Fi check result.

Returns

Type

Description

Task<WifiDetectResponse>

Malicious Wi-Fi check result.