Intermediate: Integration of Huawei Mobile Services Multi kit (Account, Analytics, Ads, Location, Push) kits in Flutter App (Cross platform) — Part 2
In this article, we will be integrating Account kit and Analytics kit in TechQuiz sample application. 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.
Introduction
In this article, we will be integrating Account kit and Analytics kit in TechQuiz sample application. 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.
Flutter plugin provides code for adapting HUAWEI Location Kit to the Flutter apps. HUAWEI Location Kit combines the GPS, Wi-Fi, and base station locations to help you quickly obtain precise user locations, build up global positioning capabilities, and reach a wide range of users around the globe.
Flutter plugin for Push kit provides a messaging channel from the cloud to devices. This helps you to maintain closer ties with users and increases user awareness and engagement with your apps.Push kit provides push token to send push notification to specific or group of user’s devices in real time.
HUAWEI Ads Publisher Service is a monetization service that leverages Huawei’s extensive data capabilities to display targeted, high quality ad content in your apps to the vast user base of Huawei devices.
Following ads has been covered in this article.
- RewardedAd
- BannerAd
- InterstitialAd
- SplashAd
- NativeAd
Flutter 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.
Restrictions
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.
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
App level gradle dependencies
Step 3: Add the below permissions in Android Manifest file.
Step 4: Download flutter plugins
Flutter plugin for Huawei analytics kit
Flutter plugin for Account kit
Flutter plugin for Location kit
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
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.
Conclusion
In this article, we have learnt to integrate Account Kit, Analytics Kit, Ads kit , Location kit and Push kit into Flutter TechQuizApp. Account kit allows you login with Huawei ID, analytics provides the app users, predefined events and custom events, location data. Push Kit provides notification through the Ag-consoles using push token. Ads kit lets you efficient ways to monetize your app and supports different types of ads implementations.
Thank you so much for reading, I hope this article helps you to understand the Huawei Account kit, Analytics kit, Ads kit, Location kit and Push kit in flutter.
Reference