Intermediate: How to Integrate Huawei Dark-Mode and App Status Awareness into Flutter Application

sujith E
3 min readMay 31, 2021



In this article, we will learn how to implement Huawei Awareness kit features, so we can easily integrate these features in to our Flutter application. In this article we are going to take a look at the Awareness kit Capture API features such as Dark mode awareness and App status awareness.

What is Huawei Awareness kit Service?

Huawei Awareness kit supports to get the app insight into a users’ current situation more efficiently, making it possible to deliver a smarter, more considerate user experience and it provides the users’ current time, location, behavior, audio device status, ambient light, weather, and nearby beacons, application status, and mobile theme mode.


1. Dark mode: It supports EMUI 10.0 or later for Huawei devices and non-Huawei devices required Android 10.0 or later (API level 29 is required).

2. App status: It supports EMUI 5.0 or later for Huawei devices and non-Huawei devices currently it is not supporting


1. Any operating system(i.e. MacOS, Linux and Windows)

2. Any IDE with Flutter SDK installed (i.e. IntelliJ, Android Studio and VsCode etc.)

3. Minimum API Level 29 is required.

4. Required EMUI 10.0 For Dark-mode and EMUI 5.0 for App status.

How to integrate HMS Dependencies.

1. First of all, we need to create an app on AppGallery Connect and add related details about HMS Core to our project. For more information check this link

2. Enable the Awareness Kit in the Manage API section and add the plugin.

3. Add the required dependencies to the build.gradle file under root folder.

maven {url ''}

classpath 'com.huawei.agconnect:agcp:'

4. Now we can implement Awareness Kit plugin. To implement Awareness Kit to our app, we need to download the plugin. Follow the URL for cross-platform plugins.

5. After completing all the above steps, you need to add the required kits’ Flutter plugins as dependencies to pubspec.yaml file. You can find all the plugins in with the latest versions.


path: ../huawei_awareness/

After adding them, run flutter pub get command. Now all the plugins are ready to use.

Note: Set multiDexEnabled to true in the android/app directory, so the app will not crash.

Use Awareness to get the dark mode status

With Dark-mode Status Awareness, we can detect the dark mode status of the device. We can get the status using capture API.

Use Awareness to get the Application status

With Application status Awareness, we can detect whether application is in which mode like silent, running using package name.

Final code here

ThemeNotifier class


Tips & Tricks

1. Download latest HMS Flutter plugin.

2. Set minSDK version to 29 or later.

3. Do not forget to click pug get after adding dependencies.

4. Do not forget to set data processing location.

5. Refer this URL for supported Devices list


In this article, I have covered two services Dark-mode awareness and App status Awareness.

Using Dark-mode awareness we can easily identify which theme currently we activated in settings page.

Using App Status awareness we can monitor the application in which state like silent or running these two we covered in this article.

Thanks for reading! If you enjoyed this story, please click the Like button and Follow. Feel free to leave a Comment 💬 below.


Awareness Kit URL