Updated 27 July 2026
Flutter Apps for Huawei Devices are becoming increasingly important as Huawei continues to expand its ecosystem with Huawei Mobile Services (HMS).
For Huawei smartphones, replace Google Mobile Services (GMS) APIs with Huawei Mobile Services (HMS) to ensure full compatibility.
This guide explains how to develop Flutter Apps for Huawei Devices and configure your project with Huawei Mobile Services (HMS).
Additionally, you’ll learn to integrate Huawei Push Kit, Map Kit, Location Kit, Analytics Kit, and Account Kit with practical Flutter code examples.
Finally, you’ll learn how to publish Flutter Apps for Huawei Devices to Huawei AppGallery with step-by-step instructions.
You can read more interesting blogs by mobikul .
In this guide, you’ll learn:
Developing Flutter apps for Huawei devices requires replacing Google Mobile Services (GMS) with Huawei Mobile Services (HMS).
This enables features such as push notifications, maps, analytics, authentication, and location services.
Examples:
| Feature | Huawei | |
|---|---|---|
| Maps | Google Maps | Huawei Map Kit |
| Push Notifications | Firebase Cloud Messaging | Huawei Push Kit |
| Analytics | Firebase Analytics | Huawei Analytics Kit |
| Authentication | Google Sign-In | Huawei Account Kit |
| Location | Google Location Services | Huawei Location Kit |
| In-App Purchase | Google Play Billing | Huawei IAP Kit |

Before you begin, configure Flutter, Android Studio, and your Huawei Developer account.
Project Level build.gradle
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
buildscript { repositories { google() mavenCentral() maven { url 'https://developer.huawei.com/repo/' } } dependencies { classpath 'com.huawei.agconnect:agcp:1.9.1.301'<span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> } |
App Level build.gradle
|
1 2 3 4 |
plugins { id 'com.android.application' id 'com.huawei.agconnect'<span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
pubspec.yaml
|
1 2 3 4 5 6 7 8 9 10 |
dependencies: flutter: sdk: flutter huawei_push: ^6.12.0+300 huawei_location: ^6.12.0+300 huawei_map: ^6.12.0+300 huawei_analytics: ^6.12.0+300 huawei_account: ^6.12.0+300 huawei_iap: ^6.12.0+300 |
Install packages
|
1 |
flutter pub get |
Place the configuration file inside:
|
1 |
android/app/agconnect-services.json |
AndroidManifest.xml
|
1 2 3 4 5 |
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> |
|
1 |
import 'package:huawei_push/huawei_push.dart'; |
|
1 2 3 4 5 6 7 8 9 10 11 |
Future<void> initPush() async { await Push.enableLogger(); Push.getToken("").then((token) { print("Push Token : $token"); }); } |
|
1 2 3 4 5 |
Push.onTokenReceivedStream.listen((event) { print(event.token); }); |
|
1 2 3 4 5 |
Push.onMessageReceivedStream.listen((RemoteMessage message) { print(message.data); <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> });</span></span> |
|
1 |
import 'package:huawei_analytics/huawei_analytics.dart'; |
|
1 2 3 4 5 |
Future<void> initAnalytics() async { await HMSAnalytics.getInstance(); <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
|
1 2 3 4 5 6 7 8 9 |
await HMSAnalytics.onEvent( "login", { "method": "email" } ); |
|
1 |
import 'package:huawei_account/huawei_account.dart'; |
|
1 2 3 4 5 6 7 8 9 |
Future<void> signIn() async { final helper = AccountAuthService(); final user = await helper.signIn(); print(user.displayName); <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
|
1 |
import 'package:huawei_location/huawei_location.dart'; |
|
1 2 3 4 5 6 7 8 |
final locationService = FusedLocationProviderClient(); Location location = await locationService.getLastLocation(); print(location.latitude); print(location.longitude); |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
HuaweiMap( initialCameraPosition: CameraPosition( target: LatLng( 28.6139, 77.2090, ), zoom: 12, ), ) |
|
1 2 3 4 5 6 7 8 9 10 |
Marker( <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> markerId: MarkerId("1"),</span></span> position: LatLng( 28.6139, 77.2090,<span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> ),</span></span> <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> )</span></span> |
|
1 |
import 'package:huawei_iap/huawei_iap.dart'; |
|
1 |
await IapClient.startIapConnection(); |
|
1 2 3 4 5 6 7 8 9 |
ProductInfoReq request = ProductInfoReq(); request.priceType = 0; request.productIds = [ "premium" ]; |
|
1 2 3 4 5 |
PurchaseIntentReq request = PurchaseIntentReq(); request.productId = "premium"; await IapClient.createPurchaseIntent(request); |
|
1 2 3 4 5 6 7 |
<span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit">import 'dart:io';</span></span> Future<bool> isHuaweiDevice() async { return Platform.isAndroid; <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
Note: For production applications, detect HMS availability instead of relying only on
Platform.isAndroid.
|
1 2 3 4 5 |
abstract class PushService { Future<void> init(); <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
|
1 2 3 4 5 6 7 8 9 10 |
class FirebasePushService implements PushService { @override Future<void> init() async { // Firebase initialization <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> <span dir="auto" style="vertical-align: inherit"><span dir="auto" style="vertical-align: inherit"> }</span></span> |
|
1 2 3 4 5 6 7 8 9 10 |
class HuaweiPushService implements PushService { @override Future<void> init() async { await Push.getToken(""); } } |
|
1 |
flutter build apk --release |
|
1 |
flutter build appbundle |
|
1 |
flutter doctor |
|
1 |
flutter pub get |
agconnect-services.json.Developing Flutter apps for Huawei devices is straightforward once your project is configured with Huawei Mobile Services (HMS).
By integrating Huawei Push Kit, Map Kit, Location Kit, Analytics Kit, Account Kit, and In-App Purchases, you can provide a seamless experience for Huawei users.
Build or migrate your Flutter app and publish it on Huawei AppGallery with HMS.
For more updates, make sure to keep following Mobikul Blogs to learn more about mobile app development.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.