Implementing Huawei Analytics and Ads kit in Flutter StoryApp

Shiddalingeshwar M S
4 min readFeb 18, 2022


In this article, we will be integrating Huawei Account, Analytics and Ads kit in StoryApp. Flutter plugin provides simple and convenient way to experience authorization of users. Flutter Account Plugin allows users to connect to the Huawei ecosystem using their Huawei IDs from the different devices such as mobiles phones and tablets, added users can login quickly and conveniently sign in to apps with their Huawei IDs after granting initial access permission.

Huawei Ads kit provides access to range of development capabilities. You can promote your apps quickly and more efficiently to Huawei’s vast users. Ads kit helps your app to be monetize quickly and start generating revenue.

Huawei supports following Ads types

  • Banner
  • Interstitial
  • Native
  • Reward
  • Splash
  • Instream(Roll)

Flutter Analytics Plugin provides wider range of predefined analytics models to get more insight into your application users, products, and content. With this insight, you can prepare data-driven approach to market your apps and optimize your products based on the analytics.

With Analytics Kit’s on-device data collection SDK, you can:

  • Collect and report custom events.
  • Set a maximum of 25 user attributes.
  • Automate event collection and session calculation.
  • Pre-set event IDs and parameters.


1. Devices:

a. Analytics Kit depends on HMS Core (APK) to automatically collect the following events: INSTALLAPP (app installation), UNINSTALLAPP (app uninstallation), CLEARNOTIFICATION (data deletion), INAPPPURCHASE (in-app purchase), RequestAd (ad request), DisplayAd (ad display), ClickAd (ad tapping), ObtainAdAward (ad award claiming), SIGNIN (sign-in), and SIGNOUT (sign-out). These events cannot be automatically collected on third-party devices where HMS Core (APK) is not installed (including but not limited to OPPO, vivo, Xiaomi, Samsung, and OnePlus).

b. Analytics Kit does not work on iOS devices.

2. Number of events:

A maximum of 500 events are supported.

3. Number of event parameters:

You can define a maximum of 25 parameters for each event, and a maximum of 100 event parameters for each project.

4. Supported countries/regions

The service is now available only in the countries/regions listed in Supported Countries/Regions.

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

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

Add path location for asset image.

Enable images in pubspec.yaml
Update plugin path in pubspec.yaml

Let’s start coding

Login screen of the sample with Banner ads
Main screen which navigates to menu and which navigates to ads screen and reports custom event when you click on Analytics in menu.
Custom Icon class
Contains list which are used in the project


Login screen and menu options
Ads screen and interstitial Ads
Reward Ads and Splash Ads
Analytics reported in last 30 min events in AppGallery
Analytics reported in last 60 min events in AppGallery
Overview of project in AppGallery Connect

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.
  • Makes sure images are defined in yaml file.


In this article, we have learnt how to integrate Account kit, Analytics and Ads kit into Huawei StoryApp for flutter. Once Account kit integrated, users can login quickly and conveniently sign in to apps with their Huawei IDs after granting initial access permission. Analytics helps you to analyze the user behavior and Ads kit helps you to monetize the app.

Thank you so much for reading, I hope this article helps you to understand the integration of Huawei Account kit, Ads kit and Analytics kit in flutter.


Ads Kit

Analytics Kit

Ads Kit — Training Video

Analytics Kit — Training Video

Checkout in forum