[Huawei Developers] Freemind R:
When there are malicious apps on a device, they can put the user’s personal information and transactions at risk. This is why HUAWEI Safety Detect provides the malicious app detection (AppsCheck) API. It enables your app to obtain a list of malicious apps installed on the user’s device, and use this to determine whether to restrict functionality such as in-app payments.

I. Service Introduction

AppsCheck in Safety Detect features in the following:

1. Detects malicious apps with an accuracy rate of 99%, according to authority.

2. Detects unknown threats based on app behavior.

The figure below illustrates the process of checking for malicious apps.

(1) Your app, which has integrated the Safety Detect SDK, calls the AppsCheck API.

(2) The AppsCheck API returns a list of malicious apps to your app.

----End

II. Use Cases

All kinds of apps have integrated the AppsCheck API, including those in the fields of finance, tools, education, photography, news, media & entertainment. With this API, your app can obtain a list of malicious apps on the device running your app.

Example: When a user scans a QR code with your app to make a payment, your app will show the user a security warning if it detects any malicious apps on the user device.

Financial apps can integrate the AppsCheck API to ensure the security of user accounts. For example, when a user makes a payment in a financial app, the app will call the AppsCheck API to obtain a list of malicious apps on the user device. If any malicious apps are detected, the financial app will display a security warning and restrict the user's in-app operations. This means the app can protect the user's private information and finances.

Media & entertainment apps can integrate the AppsCheck API to ensure that videos are only played and downloaded on devices which do not contain any malicious apps. This prevents video piracy, makes apps more secure and efficient, and enables videos to run more smoothly.

News apps can integrate the AppsCheck API to ensure users’ accounts are secure when they read news stories or perform actions such as making in-app payments.

Demo video: Opening the demo app on a device with no malicious apps.

III. Development Procedure

1 Configuring App Information in AppGallery Connect

Before you start developing an app, configure the app information in AppGallery Connect.

For details about the procedure, please refer to HUAWEI Safety Detect Development Guide.

2 Configuring the Maven Repository Address for the HMS Core SDK

2.1 Opening the build.gradle File in the Root Directory of Your Android Studio Project

2.2 Adding the AppGallery Connect Plug-in and the Maven Repository

· Go to allprojects > repositories and configure the Maven repository address for the HMS Core SDK.

allprojects {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
}

· Go to buildscript > repositories and configure the Maven repository address for the HMS Core SDK.

<p style="line-height: 1.5em;">buildscript {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
}
</p>

· Go to buildscript > dependencies and add dependency on the AppGallery Connect plug-in.

<p style="line-height: 1.5em;">buildscript{
dependencies {
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
}
}
</p>

3. Creating a SafetyDetectClient Instance

<p style="line-height: 1.5em;">// Create a SafetyDetectClient instance.
SafetyDetectClient appsCheckClient = SafetyDetect.getClient(getActivity());
}
</p>

4. Calling the AppsCheck API and Listen for the Call Result

<p style="line-height: 1.5em;">Task task = appsCheckClient.getMaliciousAppsList();
task.addOnSuccessListener(new OnSuccessListener<MaliciousAppsListResp>() {
// Obtain the malicious app check result.
@Override
public void onSuccess (MaliciousAppsListResp maliciousAppsListResp) {

}

}).addOnFailureListener(new OnFailureListener() {
// Obtain the result code and description of an exception.
@Override
public void onFailure(Exception e) {
}
});
</p>

Demo

To find out more, visit the following links:

AppsCheck API

Safety Detect Development Guide

GitHub (where you can download the demo and sample code)

Stack Overflow (where you can ask questions)