huawei_location 6.17.0+300
huawei_location: ^6.17.0+300 copied to clipboard
HUAWEI Flutter Location Kit plugin combines the Global Navigation Satellite System (GNSS), Wi-Fi, and base station location functionalities into your app.
Huawei Location Kit Flutter Plugin
Huawei Location Kit combines the Global Navigation Satellite System (GNSS), Wi-Fi, and base station location functionalities into your app to build up global positioning capabilities, allowing you to provide flexible location-based services for global users. Currently, it provides three main capabilities: fused location, activity identification, and geofence. You can call one or more of these capabilities as needed.
-
Fused Location
Provides a set of easy-to-use APIs for your app to quickly obtain the device location based on the GNSS, Wi-Fi, and base station location data.
-
Activity Identification
Identifies user motion status through the acceleration sensor, cellular network information, and magnetometer, helping you adapt your app to user behavior.
-
Geofence
Allows you to set an interested area through an API so that your app can receive a notification when a specified action (such as leaving, entering, or staying in the area) occurs.
Installation #
Please see pub.dev and AppGallery Connect Configuration.
AOSP 16 (Android 16) migration #
- Location stream handlers register dynamic receivers with
RECEIVER_NOT_EXPORTEDon Android 13+ (API 33+). - The plugin targets compileSdk / targetSdk 34; use Android Gradle Plugin 8.x and Gradle 8.x in your app.
Permissions (host app) #
Permissions (host app) #
Declare permissions your features need in android/app/src/main/AndroidManifest.xml:
| Feature | Typical permissions |
|---|---|
| Fused / foreground location | ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION |
| Background location | ACCESS_BACKGROUND_LOCATION, FOREGROUND_SERVICE, FOREGROUND_SERVICE_LOCATION (Android 14+), POST_NOTIFICATIONS (Android 13+) |
setLogConfig |
Storage / files access for log directory; use an app-specific path (e.g. getExternalFilesDir) |
Request runtime permissions in your app (the example uses permission_handler). Init Fused Location (initFusedLocationService()) is required before fused APIs such as setLogConfig.
setLogConfig may return 10803 (PERMISSION_DENIED) without storage/location grants, or 10806 (NOT_YET_SUPPORTED) on some non-Huawei devices.
Example app #
Run flutter-hms-location/example for fused location, background mode, geofence, and activity demos. See example/lib/utils/location_permissions.dart for the permission flow used in the sample.
Documentation #
Questions or Issues #
- Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.
- Huawei Developer Docs is place to official documentation for all HMS Core Kits, you can find detailed documentations in there.
If you run into a bug in our samples, please submit an issue to the GitHub repository.
License #
Huawei Location Kit Flutter Plugin is licensed under Apache 2.0 license.