Verify your App Users using Huawei Safety Detect Kit in Flutter

Shiddalingeshwar M S
4 min readNov 12, 2021

In this article, we will be integrating Huawei Safety Detect Kit in 2mg.in app application. Assuming app has huge user base and it’s very difficult to verify your app user, to make sure that app user should not be minor/ child to avoid unwanted transactions. Huawei Safety Detect Kit provides very simple and convenient way to verify your app users. It provides following feature once you integrate Kit in your app.

Introduction

In this article, we will be integrating Huawei Safety Detect Kit in 2mg.in app application. Assuming app has huge user base and it’s very difficult to verify your app user, to make sure that app user should not be minor/ child to avoid unwanted transactions. Huawei Safety Detect Kit provides very simple and convenient way to verify your app users. It provides following feature once you integrate Kit in your app.

  • SysIntegrity API: Checks whether the device running your app is secure, for example, whether it is rooted.
  • AppsCheck API: Obtains a list of malicious apps.
  • URLCheck API: Determines the threat type of a specific URL.
  • UserDetect API: Checks whether your app is interacting with a fake user.
  • WifiDetect API: Checks whether the Wi-Fi to be connected is secure.

Supported Locations and Languages

For details, please refer to Supported Locations and Languages Supported by the HMS Core SDK.

Function Restrictions

Development Overview

You need to install Flutter and Dart plugin in IDE and I assume that you have prior knowledge about the Flutter and Dart.

Hardware Requirements

  • A computer (desktop or laptop) running Windows 10.
  • A Huawei phone (with the USB cable), which is used for debugging.

Software Requirements

  • Java JDK 1.7 or later.
  • Android studio software or Visual Studio or Code installed.
  • HMS Core (APK) 4.X or later.
  • Integration process
  • Step 1: Create flutter project

Step 2: Add the App level gradle dependencies. Choose inside project Android > app > build.gradle

Root level gradle dependencies

Step 3: Add the below permissions in Android Manifest file.

Step 4: Download flutter plugins

Flutter plugin for Huawei Safety Detect Kit

Step 5: Add downloaded file into parent directory of the project. Declare plugin path in pubspec.yaml file under dependencies.

Let’s start coding

How do I call SysIntegrity API?

How do I get MaliciousAppsList?

How do I call URL check API?

How do I call User Detect API?

Result

Tricks and Tips

  • Make sure that downloaded plugin is unzipped in parent directory of project.
  • Makes sure that agconnect-services.json file added.
  • Make sure dependencies are added yaml file.
  • Run flutter pug get after adding dependencies.
  • Make sure that service is enabled in agc.

Conclusion

In this article, we have learnt to integrate Huawei Safety Detect Kit in Flutter 2mg.in. Safety Detect Kit provides very simple and convenient way to verify your app users and check for malicious apps and URL check for possible threats in specific url used by apps.

Thank you so much for reading, I hope this article helps you to understand the Huawei Safety Detect kit in flutter.

Intermediate: Integration of HMS core capabilities in Flutter App 2mg.in Part-1

Reference

Huawei Safety Detect Kit

Check out in forum

--

--