- 1. Introduction
- 2. Installation Guide
- 3. API Reference
- 4. Configuration and Description
- 5. Sample Project
- 6. Questions or Issues
- 7. Licensing and Terms
HUAWEI Awareness Kit provides your app with the ability to obtain contextual information including users' current time, location, behavior, audio device status, ambient light, weather, and nearby beacons. Your app can gain insight into a user's current situation more efficiently, making it possible to deliver a smarter, more considerate user experience.
-
Capture Client
The Capture API allows your app to request the current user status, such as time, location, behavior, and whether a headset is connected. For example, after your app runs, it can request the user's time and location in order to recommend entertainment activities available nearby at weekends to the user.
-
Barrier Client
The Barrier API allows your app to set a barrier for specific contextual conditions. When the conditions are met, your app will receive a notification. For example, a notification is triggered when an audio device connects to a mobile phone for an audio device status barrier about connection or illuminance is less than 100 lux for an ambient light barrier whose trigger condition is set for illuminance that is less than 100 lux. You can also combine different types of barriers for your app to support different use cases. For example, your app can recommend nearby services if the user has stayed in a specified business zone (geofence) for the preset period of time (time barrier).
This plugin enables communication between HUAWEI Awareness Kit SDK and Flutter platform. It exposes all functionality provided by HUAWEI Awareness Kit SDK.
-
Before you get started, you must register as a HUAWEI developer and complete identity verification on the HUAWEI Developer website. For details, please refer to Register a HUAWEI ID.
-
Create an app in your project is required in AppGallery Connect in order to communicate with Huawei services. To create an app, perform the following steps:
Step 1. Sign in to AppGallery Connect and select My projects.
Step 2. Click your project from the project list.
Step 3. Go to Project Setting > General information, and click Add app. If an app exists in the project, and you need to add a new one, expand the app selection area on the top of the page and click Add app.
Step 4. On the Add app page, enter app information, and click OK.
- A signing certificate fingerprint is used to verify the authenticity of an app when it attempts to access an HMS Core service through the HMS Core SDK. Before using HMS Core (APK), you must locally generate a signing certificate fingerprint and configure it in AppGallery Connect. Ensure that the JDK has been installed on your computer.
Step 1: Go to Project Setting > General information. In the App information field, click the icon next to SHA-256 certificate fingerprint, and enter the obtained SHA256 certificate fingerprint.
Step 2: After completing the configuration, click check mark.
Step 1: Sign in to AppGallery Connect and select My projects.
Step 2: Find your app project, and click the desired app name.
Step 3: Go to Project Setting > General information. In the App information section, click agconnect-services.json to download the configuration file.
Step 4: Create a Flutter project if you do not have one.
Step 5: Copy the agconnect-service.json file to the android/app directory of your Flutter project.
Step 6: Copy the signature file that generated in Generating a Signing Certificate section, to the android/app directory of your Flutter project.
Step 7: Check whether the agconnect-services.json file and signature file are successfully added to the android/app directory of the Flutter project.
Step 8: Open the build.gradle file in the android directory of your Flutter project.
-
Go to buildscript then configure the Maven repository address and agconnect plugin for the HMS SDK.
buildscript { repositories { google() jcenter() maven { url 'https://developer.huawei.com/repo/' } } dependencies { /* * <Other dependencies> */ classpath 'com.huawei.agconnect:agcp:1.4.2.301' } }
-
Go to allprojects then configure the Maven repository address for the HMS SDK.
allprojects { repositories { google() jcenter() maven { url 'https://developer.huawei.com/repo/' } } }
Step 9: Open the build.gradle file in the android/app directory.
-
Add
apply plugin: 'com.huawei.agconnect'
line after theapply
entries.apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.huawei.agconnect'
-
Set your package name in defaultConfig > applicationId and set minSdkVersion to 24 or higher.
-
Package name must match with the package_name entry in agconnect-services.json file.
defaultConfig { applicationId "<package_name>" minSdkVersion 24 /* * <Other configurations> */ }
-
Copy the signature file that generated in Generating a Signing Certificate to android/app directory.
-
Configure the signature in android according to the signature file information and configure Obfuscation Scripts.
android { /* * <Other configurations> */ signingConfigs { config { storeFile file('<keystore_file>.jks') storePassword '<keystore_password>' keyAlias '<key_alias>' keyPassword '<key_password>' } } buildTypes { debug { signingConfig signingConfigs.config } release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.config } } }
-
For Obfuscation Scripts, please refer to Configuring Obfuscation Scripts.
Step 10: On your Flutter project directory find and open your pubspec.yaml file and add library to dependencies.
-
To download the package from pub.dev.
dependencies: huawei_awareness: { library version }
or
If you downloaded the package from the HUAWEI Developer website, specify the library path on your local device.
dependencies: huawei_awareness: # Replace {library path} with actual library path of Huawei Awareness Plugin for Flutter. path: { library path }
- Replace {library path} with the actual library path of Flutter Awareness Plugin. The following are examples:
- Relative path example:
path: ../huawei_awareness
- Absolute path example:
path: D:\Projects\Libraries\huawei_awareness
- Relative path example:
- Replace {library path} with the actual library path of Flutter Awareness Plugin. The following are examples:
Step 11: Run following command to update package info.
[project_path]> flutter pub get
Step 12: Run following command to start the app.
[project_path]> flutter run
Main entry of capture APIs of HUAWEI Awareness Kit to obtain the headset status, behavior, time, location, beacon status, ambient light, weather, Bluetooth car stereo connection status, phone status, and capability support status.
Method | Return Type | Description |
---|---|---|
getBeaconStatus(List<BeaconFilter> filters) | Future<BeaconResponse> | Uses a variable number of the filters parameters to obtain beacon information. |
getBehavior() | Future<BehaviorResponse> | Obtains current user behavior. |
getHeadsetStatus() | Future<HeadsetResponse> | Obtains headset connection status. |
getLocation() | Future<LocationResponse> | Obtains the current location (latitude and longitude) of a device. |
getCurrentLocation() | Future<LocationResponse> | Re-obtains the latest device location information (latitude and longitude). |
getTimeCategories() | Future<TimeCategoriesResponse> | Obtains the current time. |
getTimeCategoriesByUser(double latitude, double longitude) | Future<TimeCategoriesResponse> | Obtains the current time of a specified location. |
getTimeCategoriesByCountryCode(String countryCode) | Future<TimeCategoriesResponse> | Obtains the current time by country/region code. |
getTimeCategoriesByIP() | Future<TimeCategoriesResponse> | Obtains the current time by IP address. |
getTimeCategoriesForFuture(int futureTimestamp) | Future<TimeCategoriesResponse> | Obtains the time of a specified date by IP address. |
getLightIntensity() | Future<LightIntensityResponse> | Obtains the illuminance. |
getWeatherByDevice() | Future<WeatherResponse> | Obtains the weather of the current location of a device. |
getWeatherByPosition(WeatherPosition weatherPosition) | Future<WeatherResponse> | Obtains weather information about a specified address. |
getBluetoothStatus(int deviceType) | Future<BluetoothResponse> | Obtains the Bluetooth connection status. |
getScreenStatus() | Future<ScreenStatusResponse> | Obtains the screen status response of a device. |
getWifiStatus() | Future<WiFiResponse> | Obtains the Wi-Fi connection status of a device. |
getApplicationStatus(String packageName) | Future<ApplicationResponse> | Obtains the app status of a device. |
getDarkModeStatus() | Future<DarkModeResponse> | Obtains the dark mode status of a device. |
querySupportingCapabilities() | Future<CapabilityResponse> | Obtains capabilities supported by Awareness Kit on the current device. |
enableUpdateWindow(bool status) | Future<void> | Enables/disables update window. |
Uses a variable number of the filters parameters to obtain beacon information.
Name | Type | Description |
---|---|---|
filters | List<BeaconFilter> | Beacon filter. |
Type | Description |
---|---|
Future<BeaconResponse> | Response to the request for obtaining the beacon status. |
BeaconFilter filter1 = BeaconFilter.matchByBeaconContent(
beaconNamespace: "beacon-namespace",
beaconType: "beacon-type",
beaconContent: Uint8List.fromList(utf8.encode("beacon-content")),
);
BeaconResponse response = await AwarenessCaptureClient.getBeaconStatus(filters: [filter1]);
Obtains current user behavior, for example, running, walking, cycling, or driving.
Type | Description |
---|---|
Future<BehaviorResponse> | Response to the request for obtaining the user behavior. |
BehaviorResponse response = await AwarenessCaptureClient.getBehavior();
Obtains headset connection status.
Type | Description |
---|---|
Future<HeadsetResponse> | Response to the request for obtaining the headset status. |
HeadsetResponse response = await AwarenessCaptureClient.getHeadsetStatus();
Obtains the current location (latitude and longitude) of a device. The location information obtained by using this method is the value queried last time and cached on the device.
Type | Description |
---|---|
Future<LocationResponse> | Response to the location query request. |
LocationResponse response = await AwarenessCaptureClient.getLocation();
Re-obtains the latest device location information (latitude and longitude). When this method is used to obtain the location information, the system obtains the location information again based on the current location of the device, returns the location information, and updates the location information cached on the device.
Type | Description |
---|---|
Future<LocationResponse> | Response to the location query request. |
LocationResponse response = await AwarenessCaptureClient.getCurrentLocation();
Obtains the current time.
Type | Description |
---|---|
Future<TimeCategoriesResponse> | Response to the request for obtaining the time. |
TimeCategoriesResponse response = await AwarenessCaptureClient.getTimeCategories();
Obtains the current time of a specified location.
Name | Type | Description |
---|---|---|
latitude | double | Latitude. |
longitude | double | Longitude. |
Type | Description |
---|---|
Future<TimeCategoriesResponse> | Response to the request for obtaining the time. |
TimeCategoriesResponse response = await AwarenessCaptureClient.getTimeCategoriesByUser(
latitude: 22.4943, longitude: 113.7436);
Obtains the current time by country/region code that complies with ISO 3166-1 alpha-2.
Name | Type | Description |
---|---|---|
countryCode | String | Country/Region code that complies with ISO 3166-1 alpha-2. |
Type | Description |
---|---|
Future<TimeCategoriesResponse> | Response to the request for obtaining the time. |
TimeCategoriesResponse response = await AwarenessCaptureClient.getTimeCategoriesByCountryCode(countryCode: "TR");
When this method is used, the time of the location corresponding to the IP address is returned. Note that the result returned through this method is less accurate than that returned through getTimeCategories, but this method does not require the precise location permission. You can select a method based on your actual requirements.
Type | Description |
---|---|
Future<TimeCategoriesResponse> | Response to the request for obtaining the time. |
TimeCategoriesResponse response = await AwarenessCaptureClient.getTimeCategoriesByIP();
Obtains the time of a specified date by IP address. You can specify a future date and use this method to query its time. Note that cross-year query is not supported.
Name | Type | Description |
---|---|---|
futureTimestamp | int | Timestamp of the specified date. You can only set this parameter to a timestamp in the current year, because cross-year query is not supported. The timestamp is the total number of milliseconds from 00:00:00 on January 1, 1970 (GMT) to the current time. |
Type | Description |
---|---|
Future<TimeCategoriesResponse> | Response to the request for obtaining the time. |
TimeCategoriesResponse response = await AwarenessCaptureClient.getTimeCategoriesForFuture(
futureTimestamp: time_stamp);
Obtains the illuminance.
Type | Description |
---|---|
Future<LightIntensityResponse> | Response to the request for obtaining the illuminance. |
LightIntensityResponse response = await AwarenessCaptureClient.getLightIntensity();
Obtains the weather of the current location of a device.
Type | Description |
---|---|
Future<WeatherResponse> | Response to the weather query request. |
WeatherResponse response = await AwarenessCaptureClient.getWeatherByDevice();
Obtains weather information about a specified address.
An address has five attributes: country, province, city, district, and county. The city must be set and other four attributes are optional. It is recommended that all attributes be specified to constitute an accurate address so that the returned weather information will be more accurate. When entering an address, you need to specify the language type of the address. The system returns the weather information in the corresponding language based on the language type.
For example, you can enter London, or England, London, and then specify en_GB as the locale to obtain the weather of London.
Name | Type | Description |
---|---|---|
weatherPosition | WeatherPosition | Address information for weather query, including the address and language type. |
Type | Description |
---|---|
Future<WeatherResponse> | Response to the weather query request. |
WeatherPosition position = WeatherPosition(city: "London", locale: "en_GB", country: "United Kingdom"));
WeatherResponse response = await AwarenessCaptureClient.getWeatherByPosition(weatherPosition: position);
Obtains the Bluetooth connection status.
Name | Type | Description |
---|---|---|
deviceType | int | Bluetooth device type. |
Type | Description |
---|---|
Future<BluetoothResponse> | Response to the request for obtaining the Bluetooth car stereo status. |
BluetoothResponse response = await AwarenessCaptureClient.getBluetoothStatus(
deviceType:BluetoothStatus.DeviceCar);
Obtains the screen status response of a device.
Type | Description |
---|---|
Future<ScreenStatusResponse> | Response to the request for obtaining the screen status. |
ScreenStatusResponse response = await AwarenessCaptureClient.getScreenStatus();
Obtains the Wi-Fi connection status of a device.
Type | Description |
---|---|
Future<WiFiResponse> | Response to the request for obtaining the Wi-Fi status. |
WiFiResponse response = await AwarenessCaptureClient.getWifiStatus();
Obtains the app status of a device.
Name | Type | Description |
---|---|---|
packageName | String | Package name. |
Type | Description |
---|---|
Future<ApplicationResponse> | Response to the request for obtaining the app status corresponding to a package. |
ApplicationResponse response = await AwarenessCaptureClient.getApplicationStatus(
packageName: "package_name");
Obtains the dark mode status of a device. The dark mode capture function is available only on devices with API level 29 or later.
Type | Description |
---|---|
Future<DarkModeResponse> | Response to the request for obtaining the dark mode status. |
DarkModeResponse response = await AwarenessCaptureClient.getDarkModeStatus();
Obtains capabilities supported by Awareness Kit on the current device.
Type | Description |
---|---|
Future<CapabilityResponse> | Response to the request for obtaining supported capabilities. |
CapabilityResponse capabilities = await AwarenessCaptureClient.querySupportingCapabilities();
Indicates whether to display a dialog box before Awareness Kit or HMS Core (APK) starts an upgrade in your app.
Name | Type | Description |
---|---|---|
status | bool | Indicates whether to enable or not. |
Type | Description |
---|---|
Future<void> | Future result of an execution that returns no value. |
await AwarenessCaptureClient.enableUpdateWindow(true);
Main entry of barrier APIs of HUAWEI Awareness Kit to register and obtain barriers on device.
Method | Return Type | Description |
---|---|---|
queryBarriers(BarrierQueryRequest request) | Future<BarrierQueryResponse> | Queries the current status of a target barrier/s. |
deleteBarrier(BarrierDeleteRequest request) | Future<bool> | Deletes barrier/s. |
updateBarrier(AwarenessBarrier barrier, bool autoRemove) | Future<bool> | Adds or updates barriers. |
enableUpdateWindow(bool status) | Future<void> | Enables/disables update window. |
Method | Return Type | Description |
---|---|---|
onBarrierStatusStream | Stream<BarrierStatus> | The listenable stream that emits BarrierStatus objects. |
Queries the current status of a target barrier/s.
Name | Type | Description |
---|---|---|
request | BarrierQueryRequest | Query request containing query condition parameters. |
Type | Description |
---|---|
Future<BarrierQueryResponse> | Target barrier information, including the key value and current status. |
BarrierQueryResponse response = await AwarenessBarrierClient.queryBarriers(BarrierQueryRequest.all());
Deletes barrier/s.
Name | Type | Description |
---|---|---|
request | BarrierDeleteRequest | Delete request containing delete condition parameters. |
Type | Description |
---|---|
Future<bool> | The value true indicates successful task execution. |
bool status = await AwarenessBarrierClient.deleteBarrier(BarrierDeleteRequest.all());
Adds or updates barriers.
If a barrier is added using a key that has been registered, the new barrier will replace the original one. No matter whether the new barrier is registered successfully, all callback requests of the original one will be invalid.
Name | Type | Description |
---|---|---|
barrier | AwarenessBarrier | AwarenessBarrier object to be added or updated. |
autoRemove | bool | Indicates whether to enable the autoRemove function. |
- autoRemove as true: The autoRemove function is enabled. When the number of registered barriers exceeds the upper limit, the system automatically deletes the earliest registered barrier and registers a new one.
- autoRemove as false: The autoRemove function is not enabled. When the number of registered barriers exceeds the upper limit, the system does not delete the earliest registered barrier. As a result, a new barrier fails to be registered.
Type | Description |
---|---|
Future<bool> | The value true indicates successful task execution. |
HeadsetBarrier headsetBarrier = HeadsetBarrier.keeping(
barrierLabel: "Headset Barrier",
headsetStatus: HeadsetStatus.Connected);
bool status = await AwarenessBarrierClient.updateBarriers(barrier: headsetBarrier);
Indicates whether to display a dialog box before Awareness Kit or HMS Core (APK) starts an upgrade in your app.
Name | Type | Description |
---|---|---|
status | bool | Indicates whether to enable or not. |
Type | Description |
---|---|
Future<void> | Future result of an execution that returns no value. |
await AwarenessBarrierClient.enableUpdateWindow(true);
The listenable stream that emits BarrierStatus objects.
Type | Description |
---|---|
Stream<BarrierStatus> | The listenable stream that emits BarrierStatus objects. |
_onStatusReceived(BarrierStatus status){
String barrierLabel = status.barrierLabel;
log(barrierLabel, name: "Barrier Label");
}
_onStatusReceiveError(Object error) {
print("onStatusReceiveError: " + error.toString());
}
AwarenessBarrierClient.onBarrierStatusStream.listen(_onStatusReceived, onError: _onStatusReceiveError);
Main entry of utility APIs of HUAWEI Awareness Kit for permissions and HMSLogger handling.
Method | Return Type | Description |
---|---|---|
enableLogger() | Future<void> | This method enables the HMSLogger capability which is used for sending usage analytics of Awareness SDK's methods to improve the service quality. |
disableLogger() | Future<void> | This method disables the HMSLogger capability which is used for sending usage analytics of Awareness SDK's methods to improve the service quality. |
hasLocationPermission() | Future<bool> | This API is used to check location permission is available or not. |
hasBackgroundLocationPermission() | Future<bool> | This API is used to check background location permission is available or not. |
hasActivityRecognitionPermission() | Future<bool> | This API is used to check activity permission is available or not. |
requestLocationPermission() | Future<bool> | This API is used to request location permission. |
requestBackgroundLocationPermission() | Future<bool> | This API is used to request background location permission. |
requestActivityRecognitionPermission() | Future<bool> | This API is used to request activity recognition permission. |
This method enables the HMSLogger capability which is used for sending usage analytics of Awareness SDK's methods to improve the service quality.
Type | Description |
---|---|
Future<void> | Future result of an execution that returns no value. |
AwarenessUtilsClient.enableLogger();
This method disables the HMSLogger capability which is used for sending usage analytics of Awareness SDK's methods to improve the service quality.
Type | Description |
---|---|
Future<void> | Future result of an execution that returns no value. |
AwarenessUtilsClient.disableLogger();
This API is used to check location permission is available or not.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool locationPermission = await AwarenessUtilsClient.hasLocationPermission();
This API is used to check background location permission is available or not.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool backgroundLocationPermission = await AwarenessUtilsClient.hasBackgroundLocationPermission();
This API is used to check activity recognition permission is available or not.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool activityRecognitionPermission = await AwarenessUtilsClient.hasActivityRecognitionPermission();
This API is used to request location permission.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool status = await AwarenessUtilsClient.requestLocationPermission();
This API is used to request background location permission.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool status = await AwarenessUtilsClient.requestBackgroundLocationPermission();
This API is used to request activity recognition permission.
Type | Description |
---|---|
Future<bool> | Returns true if permission is granted, else returns false. |
bool status = await AwarenessUtilsClient.requestActivityRecognitionPermission();
Class | Description |
---|---|
AmbientLightBarrier | Illuminance barriers, including below, above, and range barriers. |
BeaconBarrier | Beacon barriers, including the discover, keep, and missed barriers. |
BehaviorBarrier | Behavior barriers, including the beginning, ending, and keeping barriers of behaviors. |
BluetoothBarrier | Bluetooth barriers, including the connecting, disconnecting, and keeping barriers. |
CombinationBarrier | Obtains the integrated barriers after the specific logic operation is executed. |
HeadsetBarrier | Headset barriers, including the connecting, disconnecting, and keeping barriers. |
LocationBarrier | Location barriers, including the enter, exit, and stay barriers. |
ScreenBarrier | Screen barriers, including the status keeping, screen-on, screen-off, and screen-unlock barriers. |
TimeBarrier | Time barriers, including the barriers to be triggered at a time or periodically based on time. |
WifiBarrier | Wi-Fi barriers, including the keeping, connecting, disconnecting, enabling, and disabling barriers. |
Barrier | Registered barrier information. |
BarrierStatus | The barrier status includes the barrier label, current status, previous status, and last status update time. |
BarrierDeleteRequest | Deletes a barrier based on the key value. |
BarrierQueryRequest | Barrier query request. |
BarrierQueryResponse | Barrier query response. |
ApplicationResponse | Response to the request for obtaining the app status corresponding to a package. |
BeaconResponse | Response to the request for obtaining the beacon status. |
BehaviorResponse | Response to the request for obtaining the user behavior. |
BluetoothResponse | Response to the request for obtaining the Bluetooth car stereo status. |
CapabilityResponse | Response to the request for obtaining supported capabilities. |
DarkModeResponse | Response to the request for obtaining the dark mode status. |
HeadsetResponse | Response to the request for obtaining the headset status. |
LightIntensityResponse | Response to the request for obtaining the illuminance. |
LocationResponse | Response to the location query request. |
ScreenStatusResponse | Response to the request for obtaining the screen status. |
TimeCategoriesResponse | Response to the request for obtaining the time. |
WeatherResponse | Response to the weather query request. |
WifiResponse | Response to the request for obtaining the Wi-Fi status. |
BeaconData | Beacon information. |
DetectedBehavior | Type and confidence of a detected behavior. |
WeatherPosition | Request parameter class, which is used to pass address information to obtain weather information. |
Aqi | Air quality indexes. |
City | City information including the city code, province name, time zone, and city/district name. |
DailyLiveInfo | Information about a living index on a day. |
DailySituation | Weather conditions in the daytime or at night. |
DailyWeather | Weather information of the current day and the next six to seven days. |
HourlyWeather | Weather information in the current hour and the next 24 hours. |
LiveInfo | Living index level for the day and the next one or two days. |
Situation | Current weather information. |
WeatherSituation | Current weather information, which consists of the current weather information (specified by Situation) and city information (specified by City). |
BeaconFilter | Represents filter for beacons. |
ApplicationStatus | Represents constants for Application Status. |
AwarenessStatusCodes | Represents constants for Awareness Status Codes. |
BluetoothStatus | Represents constants for Bluetooth Status. |
CapabilityStatus | Represents constants for Capability Status. |
HeadsetStatus | Represents constants for Headset Status. |
ScreenStatus | Represents constants for Screen Status. |
WeatherId | Represents constants for Weather ID. |
WiFiStatus | Represents constants for WiFi Status. |
- For more detailed information about classes and constants, please refer to Official Huawei Awareness Flutter Plugin Documentation.
Illuminance barriers, including below, above, and range barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
minLightIntensity | double | Minimum illuminance. |
maxLightIntensity | double | Maximum illuminance. |
Constructor | Description |
---|---|
AmbientLightBarrier.above(String barrierLabel, double minLightIntensity) | Illuminance barrier named above. |
AmbientLightBarrier.below(String barrierLabel, double maxLightIntensity) | Illuminance barrier named below. |
AmbientLightBarrier.range(String barrierLabel, double minLightIntensity, double maxLightIntensity) | Illuminance barrier named range. |
When the illuminance is within the range specified by [minLightIntensity, Float.MAX_VALUE), the barrier status is True and a barrier event is reported. When the illuminance is not within the range, the barrier status is False and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
minLightIntensity | double | Minimum illuminance. |
When the illuminance is within the range specified by [0, maxLightIntensity), the barrier status is True and a barrier event is reported. When the illuminance is not within the range, the barrier status is False and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
maxLightIntensity | double | Maximum illuminance. |
When the illuminance is within the range specified by [minLightIntensity, maxLightIntensity), the barrier status is True and a barrier event is reported. When the illuminance is not within the range, the barrier status is False and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
minLightIntensity | double | Minimum illuminance. |
maxLightIntensity | double | Maximum illuminance. |
Beacon barriers, including the discover, keep, and missed barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
filters | List<BeaconFilter> | Beacon filters. |
Constructor | Description |
---|---|
BeaconBarrier.discover(String barrierLabel, List<BeaconFilter> filters) | Beacon barrier named discover. |
BeaconBarrier.missed(String barrierLabel, List<BeaconFilter> filters) | Beacon barrier named missed. |
BeaconBarrier.keep(String barrierLabel, List<BeaconFilter> filters) | Beacon barrier named keep. |
- To use this barrier, you need to add the android.permission.ACCESS_FINE_LOCATION and android.permission.BLUETOOTH permissions.
After this barrier is added, when a beacon of a specified type is found, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
filters | List<BeaconFilter> | Beacon filters. |
After this barrier is added, when a beacon of a specified type is lost, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
filters | List<BeaconFilter> | Beacon filters. |
After this barrier is added, when a nearby beacon of a specified type is found and not lost, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
filters | List<BeaconFilter> | Beacon filters. |
Behavior barriers, including the beginning, ending, and keeping barriers of behaviors.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
behaviorTypes | List<int> | One or more behavior type constants. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Constructor | Description |
---|---|
BehaviorBarrier.keeping(String barrierLabel, List<int> behaviorTypes) | Behavior barrier named keeping. |
BehaviorBarrier.beginning(String barrierLabel, List<int> behaviorTypes) | Behavior barrier named beginning. |
BehaviorBarrier.ending(String barrierLabel, List<int> behaviorTypes) | Behavior barrier named ending. |
After the barrier in a specified behavior status (excluding Unkown) is added, when a user is in the behavior status, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
behaviorTypes | List<int> | One or more behavior type constants. |
After the barrier in a specified behavior status (excluding Unkown) is added, when a user is in the behavior status, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
behaviorTypes | List<int> | One or more behavior type constants. |
After the barrier in a specified behavior status (excluding Unkown) is added, when a user stops the behavior, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
behaviorTypes | List<int> | One or more behavior type constants. |
Bluetooth barriers, including the connecting, disconnecting, and keeping barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
bluetoothStatus | int | Connection status of the Bluetooth device. |
deviceType | int | Bluetooth device type. |
Constructor | Description |
---|---|
BluetoothBarrier.keeping(String barrierLabel, int bluetoothStatus, int deviceType) | Bluetooth barrier named keeping. |
BluetoothBarrier.connecting(String barrierLabel, int deviceType) | Bluetooth barrier named connecting. |
BluetoothBarrier.disconnecting(String barrierLabel, int deviceType) | Bluetooth barrier named disconnecting. |
- To use this barrier, you need to add the android.permission.BLUETOOTH permission.
After you add this barrier for a Bluetooth state such as Connected or Disconnected, if the Bluetooth keeps in this state, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
bluetoothStatus | int | Connection status of the Bluetooth device. |
deviceType | int | Bluetooth device type. |
After you add this barrier, if a Bluetooth device is connected, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
deviceType | int | Bluetooth device type. |
After you add this barrier, if a Bluetooth device is disconnected, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
deviceType | int | Bluetooth device type. |
Obtains the integrated barriers after the specific logic operation is executed.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
Constructor | Description |
---|---|
CombinationBarrier.not(String barrierLabel, AwarenessBarrier barrier) | Obtains the barrier after the NOT logic operation is executed. |
CombinationBarrier.and(String barrierLabel, List<AwarenessBarrier> barriers) | Obtains the integrated barriers after the AND logic operation is executed. |
CombinationBarrier.or(String barrierLabel, List<AwarenessBarrier> barriers) | Obtains the barrier after the OR logic operation is executed. |
Obtains the barrier after the NOT logic operation is executed.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
barrier | AwarenessBarrier | Barrier. |
Obtains the integrated barriers after the AND logic operation is executed.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
barriers | List<AwarenessBarrier> | Barriers. |
Obtains the barrier after the OR logic operation is executed.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
barriers | List<AwarenessBarrier> | Barriers. |
Headset barriers, including the connecting, disconnecting, and keeping barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
headsetStatus | int | Headset status. |
Constructor | Description |
---|---|
HeadsetBarrier.keeping(String barrierLabel, int headsetStatus) | Headset barrier named keeping. |
HeadsetBarrier.connecting(String barrierLabel) | Headset barrier named connecting. |
HeadsetBarrier.disconnecting(String barrierLabel) | Headset barrier named disconnecting. |
- To use this barrier, you need to add the android.permission.BLUETOOTH permission.
After you add this barrier with headset status Connected and Disconnected, when the headset is in specified state, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
headsetStatus | int | Headset status. |
After this barrier is added, when a headset is connected to a device, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
After this barrier is added, when a headset is disconnected, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
Location barriers, including the enter, exit, and stay barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
latitude | double | Center latitude of an area. The unit is degree and the value range is [–90°,90°]. |
longitude | double | Center longitude of an area. The unit is degree and the value range is (–180°,180°]. |
radius | double | Radius of an area. The unit is meter. |
timeOfDuration | int | Minimum stay time in a specified area. The unit is millisecond. |
Constructor | Description |
---|---|
LocationBarrier.enter(String barrierLabel, double latitude, double longitude, double radius) | Barrier named enter. |
LocationBarrier.stay(String barrierLabel, double latitude, double longitude, double radius, int timeOfDuration) | Barrier named exit. |
LocationBarrier.exit(String barrierLabel, double latitude, double longitude, double radius) | Barrier named stay. |
- To use this barrier, you need to add the android.permission.ACCESS_FINE_LOCATION permission. For Android 10 or later, you also need to add the android.permission.ACCESS_BACKGROUND_LOCATION permission.
After this barrier is added, when a user enters a specified area, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
latitude | double | Center latitude of an area. The unit is degree and the value range is [–90°,90°]. |
longitude | double | Center longitude of an area. The unit is degree and the value range is (–180°,180°]. |
radius | double | Radius of an area. The unit is meter. |
LocationBarrier.stay(String barrierLabel, double latitude, double longitude, double radius, int timeOfDuration)
After this barrier is added, when a user exits from a specified area, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
latitude | double | Center latitude of an area. The unit is degree and the value range is [–90°,90°]. |
longitude | double | Center longitude of an area. The unit is degree and the value range is (–180°,180°]. |
radius | double | Radius of an area. The unit is meter. |
timeOfDuration | int | Minimum stay time in a specified area. The unit is millisecond. |
After this barrier is added, if a user is in a specified area, the barrier status is True; if a user enters the area and stays in the area for a specified time period, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
latitude | double | Center latitude of an area. The unit is degree and the value range is [–90°,90°]. |
longitude | double | Center longitude of an area. The unit is degree and the value range is (–180°,180°]. |
radius | double | Radius of an area. The unit is meter. |
Screen barriers, including the status keeping, screen-on, screen-off, and screen-unlock barriers. You should remind users that the screen status of their phones may be monitored by the app.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
screenStatus | int | Screen status. |
Constructor | Description |
---|---|
ScreenBarrier.keeping(String barrierLabel, int screenStatus) | Screen status barrier named keeping. |
ScreenBarrier.screenOn(String barrierLabel) | Screen status barrier named screenOn. |
ScreenBarrier.screenOff(String barrierLabel) | Screen status barrier named screenOff. |
ScreenBarrier.screenUnlock(String barrierLabel) | Screen status barrier named screenUnlock. |
After you add this barrier for a screen state such as ScreenOn, ScreenOff, or Unlock, if the screen keeps in this state, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
screenStatus | int | Screen status. |
After this barrier is added, when the screen is on but locked, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
After this barrier is added, when the screen is off, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
After this barrier is added, when the screen is unlocked, the barrier status is True and a barrier event is reported. After 5s, the barrier status changes to False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
Time barriers, including the barriers to be triggered at a time or periodically based on time.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
timeInstant | int | Sunrise or sunset. |
startTimeOffset | int | Start time offset of the time barrier. |
stopTimeOffset | int | Stop time offset of the time barrier. |
startTimeOfDay | int | Start time of the barrier, in milliseconds. |
stopTimeOfDay | int | Stop time of the barrier, in milliseconds. |
startTimeStamp | int | Start timestamp. |
stopTimeStamp | int | Stop timestamp. |
dayOfWeek | int | Day of a week. |
startTimeOfSpecifiedDay | int | Start time of the barrier, in milliseconds. |
stopTimeOfSpecifiedDay | int | Stop time of the barrier, in milliseconds. |
inTimeCategory | int | Time. |
timeZoneId | String | Sets the time zone. |
- For more datailed information, please refer to Official Huawei Awareness Flutter Plugin Documentation.
Constructor | Description |
---|---|
TimeBarrier.inSunriseOrSunsetPeriod(String barrierLabel, int timeInstant, int startTimeOffset, int stopTimeOffset) | Sunrise and sunset barrier. |
TimeBarrier.duringPeriodOfDay(String barrierLabel, int startTimeOfDay, int stopTimeOfDay, String timeZoneId) | Barrier of a specified time period. |
TimeBarrier.duringTimePeriod(String barrierLabel, int startTimeStamp, int stopTimeStamp) | Time period barrier. |
TimeBarrier.duringPeriodOfWeek(String barrierLabel, int dayOfWeek, int startTimeOfSpecifiedDay, int stopTimeOfSpecifiedDay, String timeZoneId) | Barrier for a specific day of a week. |
TimeBarrier.inTimeCategory(String barrierLabel, int inTimeCategory) | Time barrier. |
- android.permission.ACCESS_FINE_LOCATION permission is required for TimeBarrier.inSunriseOrSunsetPeriod, TimeBarrier.duringPeriodOfDay and TimeBarrier.duringPeriodOfWeek barriers.
TimeBarrier.inSunriseOrSunsetPeriod(String barrierLabel, int timeInstant, int startTimeOffset, int stopTimeOffset)
After this barrier is added, when the time is in the specified time period using the sunrise or sunset time as the benchmark, the barrier status is True. Otherwise, the barrier status is False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
timeInstant | int | Sunrise or sunset. |
startTimeOffset | int | Start time offset of the time barrier. The unit is millisecond. The value range is milliseconds from –24 hours to +24 hours. The value must be less than the value of stopTimeOffset. |
stopTimeOffset | int | Stop time offset of the time barrier. The unit is millisecond. The value range is milliseconds from –24 hours to +24 hours. The value must be greater than the value of startTimeOffset. |
TimeBarrier.duringPeriodOfDay(String barrierLabel, int startTimeOfDay, int stopTimeOfDay, String timeZoneId)
After this barrier is added, when the time is in the specified time period of a specified time zone, the barrier status is True. Otherwise, the barrier status is False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
startTimeOfDay | int | Start time of the barrier, in milliseconds. The value 0 indicates 00:00. The maximum value is the number of milliseconds of 24 hours. |
stopTimeOfDay | int | Stop time of the barrier, in milliseconds. The value of stopTimeOfDay must be greater than or equal to the value of startTimeOfDay. |
timeZoneId | String | Time zone specified by you. If the time zone does not exist, the time zone of the area where the user is located is used. |
After this barrier is added, when the time is in the specified time period, the barrier status is True. Otherwise, the barrier status is False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
startTimeStamp | int | Start timestamp. The value must be greater than or equal to 0. |
stopTimeStamp | int | Stop timestamp. The value of stopTimeStamp must be greater than or equal to that of startTimeStamp. |
TimeBarrier.duringPeriodOfWeek(String barrierLabel, int dayOfWeek, int startTimeOfSpecifiedDay, int stopTimeOfSpecifiedDay, String timeZoneId)
After this barrier is added, when the time is in the specified time period on a day of a week in a specified time zone, the barrier status is True. Otherwise, the barrier status is False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
dayOfWeek | int | Day of a week. |
startTimeOfSpecifiedDay | int | Start time of the barrier, in milliseconds. The value 0 indicates 00:00. The maximum value is the number of milliseconds of 24 hours. |
stopTimeOfSpecifiedDay | int | Stop time of the barrier, in milliseconds. The value of stopTimeOfSpecifiedDay must be greater than or equal to the value of startTimeOfSpecifiedDay. |
timeZoneId | String | Sets the time zone. If the time zone does not exist, the time zone of the area where the user is located is used. |
After this barrier is added, the barrier status is True for the specified time. Otherwise, the barrier status is False.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
inTimeCategory | int | Time. |
Wi-Fi barriers, including the keeping (Wi-Fi status keeping), connecting (Wi-Fi connection), disconnecting (Wi-Fi disconnection), enabling (WLAN enabling), and disabling (WLAN disabling) barriers.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
wifiStatus | int | Wi-Fi status. |
bssid | String | (BSSID) Physical address of the Wi-Fi source. |
ssid | String | (SSID) Name of the Wi-Fi source. |
Constructor | Description |
---|---|
WiFiBarrier.keeping(String barrierLabel, int wifiStatus, String bssid, String ssid) | Wi-Fi status barrier named keeping. |
WiFiBarrier.connecting(String barrierLabel, String bssid, String ssid) | Wi-Fi status barrier named connecting. |
WiFiBarrier.disconnecting(String barrierLabel, String bssid, String ssid) | Wi-Fi status barrier named disconnecting. |
WiFiBarrier.enabling(String barrierLabel) | Wi-Fi status barrier named enabling. |
WiFiBarrier.disabling(String barrierLabel) | Wi-Fi status barrier named disabling. |
After you add this barrier for a Wi-Fi state such as Enabled, Disabled, Connected, or Disconnected, if the Wi-Fi keeps in this state, the barrier status is True and a barrier event is reported.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
wifiStatus | int | Wi-Fi status. |
bssid | String | If the value of wifiStatus is Connected or Disabled, the BSSID (physical address of the Wi-Fi source) of the Wi-Fi barrier can be specified. The value null indicates any BSSID. If the value of wifiStatus is Enabled or Disabled, the BSSID is invalid. |
ssid | String | If the value of wifiStatus is Connected or Disconnected, the SSID (name of the Wi-Fi source) of the Wi-Fi barrier can be specified. The value null indicates any SSID. If the value of wifiStatus is Enabled or Disabled, the SSID is invalid. |
When a device connects to a Wi-Fi, the barrier status is True and a barrier event is reported. The value automatically changes to False 5s later. If GPS is disabled on the device, the barrier status cannot be correctly determined.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
bssid | String | BSSID (physical address of the Wi-Fi source) of a specific Wi-Fi. The value null indicates any BSSID. |
ssid | String | SSID (name of the Wi-Fi source) of a specific Wi-Fi. The value null indicates any SSID. |
When a device disconnects from a Wi-Fi, the barrier status is True and a barrier event is reported. The value automatically changes to False 5s later.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
bssid | String | BSSID (physical address of the Wi-Fi source) of a specific Wi-Fi. The value null indicates any BSSID. |
ssid | String | SSID (name of the Wi-Fi source) of a specific Wi-Fi. The value null indicates any SSID. |
When a device enables WLAN, the barrier status is True and a barrier event is reported. The value automatically changes to False 5s later.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
When a device disables WLAN, the barrier status is True and a barrier event is reported. The value automatically changes to False 5s later.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
Registered barrier information.
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
barrierStatus | BarrierStatus | Barrier status. |
Constructor | Description |
---|---|
Barrier(String barrierLabel, BarrierStatus barrierStatus) | Default constructor. |
Constructor for Barrier object.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
barrierStatus | BarrierStatus | Barrier status. |
The barrier status includes the barrier label, current status, previous status, and last status update time.
Name | Type | Description |
---|---|---|
barrierLabel | String | Key value that uniquely identifies a barrier. |
lastBarrierUpdateTime | int | The timestamp of the last barrier status change. |
lastStatus | int | The previous barrier status. |
presentStatus | int | The current barrier status. |
Constant | Type | Value | Description |
---|---|---|---|
True | int | 1 | Barrier status TRUE. |
False | int | 0 | Barrier status FALSE. |
Unknown | int | 2 | Barrier status UNKNOWN. |
Constructor | Description |
---|---|
BarrierStatus(String barrierLabel, int lastBarrierUpdateTime, int lastStatus, int presentStatus) | Default constructor. |
Constructor for BarrierStatus object.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Key value that uniquely identifies a barrier. |
lastBarrierUpdateTime | int | The timestamp of the last barrier status change. |
lastStatus | int | The previous barrier status. |
presentStatus | int | The current barrier status. |
Deletes a barrier based on the key value.
Constructor | Description |
---|---|
BarrierDeleteRequest.all() | Creates a BarrierDeleteRequest object that deletes all registered barriers. |
BarrierDeleteRequest.withLabel(String barrierLabel) | Creates a BarrierDeleteRequest object that deletes the specified barrier. |
Creates a BarrierDeleteRequest object that deletes all registered barriers.
Creates a BarrierDeleteRequest object that deletes the specified barrier.
Parameters
Name | Type | Description |
---|---|---|
barrierLabel | String | Barrier label. |
Barrier query request.
Constructor | Description |
---|---|
BarrierQueryRequest.all() | Creates a BarrierQueryRequest object that queries all registered barriers. |
BarrierQueryRequest.forBarriers(List<String> barrierKeys) | Creates a BarrierQueryRequest object that queries the specified barriers. |
Creates a BarrierQueryRequest object that queries all registered barriers.
Creates a BarrierQueryRequest object that queries the specified barriers.
Parameters
Name | Type | Description |
---|---|---|
barrierKeys | List<String> | Barrier labels. |
Barrier query response.
Name | Type | Description |
---|---|---|
barriers | List<Barrier> | List of registered barriers. |
Constructor | Description |
---|---|
BarrierQueryResponse(List<Barrier> barriers) | Default constructor. |
Constructor for BarrierQueryResponse object.
Parameters
Name | Type | Description |
---|---|---|
barriers | List<Barrier> barriers | List of registered barriers. |
Response to the request for obtaining the app status corresponding to a package, which can be obtained by calling the getApplicationStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
applicationStatus | int | The application status. |
Constructor | Description |
---|---|
ApplicationResponse(int applicationStatus) | Default constructor. |
Constructor for ApplicationResponse object.
Parameters
Name | Type | Description |
---|---|---|
applicationStatus | int | The application status. |
Response to the request for obtaining the beacon status, which can be obtained by calling the getBeaconStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
beacons | List<BeaconData> | Beacon device status information. |
Constructor | Description |
---|---|
BeaconResponse(List<BeaconData> beacons) | Default constructor. |
Constructor for BeaconResponse object.
Parameters
Name | Type | Description |
---|---|---|
beacons | List<BeaconData> | Beacon device status information. |
Response to the request for obtaining the user behavior, which can be obtained by calling the getBehavior method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
elapsedRealtimeMillis | int | Actual time (in milliseconds) used for this detection since startup. |
time | int | Timestamp of the current detection. |
mostLikelyBehavior | DetectedBehavior | Most likely behavior. |
probableBehavior | List<DetectedBehavior> | Detected behaviors, which are sorted by confidence (most likely first). |
Constructor | Description |
---|---|
BehaviorResponse(int elapsedRealtimeMillis, int time, DetectedBehavior mostLikelyBehavior, List<DetectedBehavior> probableBehavior) | Default constructor. |
BehaviorResponse(int elapsedRealtimeMillis, int time, DetectedBehavior mostLikelyBehavior, List<DetectedBehavior> probableBehavior)
Constructor for BehaviorResponse object.
Parameters
Name | Type | Description |
---|---|---|
elapsedRealtimeMillis | int | Actual time (in milliseconds) used for this detection since startup. |
time | int | Timestamp of the current detection. |
mostLikelyBehavior | DetectedBehavior | Most likely behavior. |
probableBehavior | List<DetectedBehavior> | Detected behaviors, which are sorted by confidence (most likely first). |
Response to the request for obtaining the Bluetooth car stereo status, which can be obtained by calling the getBluetoothStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
bluetoothStatus | int | Bluetooth status. |
Constructor | Description |
---|---|
BluetoothResponse(int bluetoothStatus) | Default constructor. |
Constructor for BluetoothResponse object.
Parameters
Name | Type | Description |
---|---|---|
bluetoothStatus | int | Bluetooth status. |
Response to the request for obtaining supported capabilities, which can be obtained by calling the querySupportingCapabilities method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
deviceSupportCapabilities | List<int> | Status constants of capabilities supported by Awareness Kit on the current device. |
Constructor | Description |
---|---|
CapabilityResponse(List<int> deviceSupportCapabilities) | Default constructor. |
Constructor for CapabilityResponse object.
Parameters
Name | Type | Description |
---|---|---|
deviceSupportCapabilities | List<int> | Status constants of capabilities supported by Awareness Kit on the current device. |
Response to the request for obtaining the dark mode status, which can be obtained by calling the getDarkModeStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
isDartModeOn | bool | Dark mode status. |
Constructor | Description |
---|---|
DarkModeResponse(bool isDarkModeOn) | Default constructor. |
Constructor for DarkModeResponse object.
Parameters
Name | Type | Description |
---|---|---|
isDarkModeOn | bool | Dark mode status. |
Response to the request for obtaining the headset status, which can be obtained by calling the getHeadsetStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
headsetStatus | int | Headset status. |
Constructor | Description |
---|---|
HeadsetResponse(int headsetStatus) | Default constructor. |
Constructor for HeadsetResponse object.
Parameters
Name | Type | Description |
---|---|---|
headsetStatus | int | Headset status. |
Response to the request for obtaining the illuminance, which can be obtained by calling the getLightIntensity method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
lightIntensity | double | Illuminance value. |
Constructor | Description |
---|---|
LightIntensityResponse(double lightIntensity) | Default constructor. |
Constructor for LightIntensityResponse object.
Parameters
Name | Type | Description |
---|---|---|
lightIntensity | double | Illuminance value. |
Response to the location query request. Your app can call the getLocation method provided by AwarenessCaptureClient to obtain the last geographical location response or call the getCurrentLocation method to obtain the current geographical location response.
Name | Type | Description |
---|---|---|
latitude | double | Latitude, in degrees. |
longitude | double | Longitude, in degrees. |
altitude | double | Altitude if available, in meters above the WGS 84 reference ellipsoid. |
speed | double | Speed if it is available, in meters/second over ground. |
bearing | double | The bearing, in degrees. |
accuracy | double | Estimated horizontal accuracy of this location, radial, in meters. |
verticalAccuracyMeters | double | Estimated vertical accuracy of this location, in meters. |
bearingAccuracyDegrees | double | Estimated bearing accuracy of this location, in degrees. |
speedAccuracyMetersPerSecond | double | Estimated speed accuracy of this location, in meters per second. |
time | int | Time in milliseconds since January 1, 1970. |
fromMockProvider | bool | Location provider status. |
Constructor | Description |
---|---|
LocationResponse(double latitude, double longitude, double altitude, double speed, double bearing, double accuracy, double verticalAccuracyMeters, double bearingAccuracyDegrees, double speedAccuracyMetersPerSecond, int time, bool fromMockProvider) | Default constructor. |
LocationResponse(double latitude, double longitude, double altitude, double speed, double bearing, double accuracy, double verticalAccuracyMeters, double bearingAccuracyDegrees, double speedAccuracyMetersPerSecond, int time, bool fromMockProvider)
Constructor for LocationResponse object.
Parameters
Name | Type | Description |
---|---|---|
latitude | double | Latitude, in degrees. |
longitude | double | Longitude, in degrees. |
altitude | double | Altitude if available, in meters above the WGS 84 reference ellipsoid. |
speed | double | Speed if it is available, in meters/second over ground. |
bearing | double | The bearing, in degrees. |
accuracy | double | Estimated horizontal accuracy of this location, radial, in meters. |
verticalAccuracyMeters | double | Estimated vertical accuracy of this location, in meters. |
bearingAccuracyDegrees | double | Estimated bearing accuracy of this location, in degrees. |
speedAccuracyMetersPerSecond | double | Estimated speed accuracy of this location, in meters per second. |
time | int | Time in milliseconds since January 1, 1970. |
fromMockProvider | bool | Location provider status. |
Response to the request for obtaining the screen status. You can call the getScreenStatus method provided by AwarenessCaptureClient to obtain the response instance of the screen status.
Name | Type | Description |
---|---|---|
screenStatus | int | Displays screen status information. |
Constructor | Description |
---|---|
ScreenStatusResponse(int screenStatus) | Default constructor. |
Constructor for ScreenStatus object.
Parameters
Name | Type | Description |
---|---|---|
screenStatus | int | Displays screen status information. |
Response to the request for obtaining the time, which can be obtained by calling the getTimeCategories method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
timeCategories | List<int> | Time categories. |
Constructor | Description |
---|---|
TimeCategoriesResponse(List<int> timeCategories) | Default constructor. |
Constructor for TimeCategoriesResponse object.
Parameters
Name | Type | Description |
---|---|---|
timeCategories | List<int> | Time categories. |
Response to the weather query request. You can call the getWeatherByDevice method provided by AwarenessCaptureClient to obtain the weather of the current location of a device, or call the getWeatherByPosition method to obtain the weather of a specified position.
Name | Type | Description |
---|---|---|
dailyWeather | List<DailyWeather> | Weather information of the next seven days. |
hourlyWeather | List<HourlyWeather> | Weather information in the next 24 hours. |
liveInfo | List<LiveInfo> | The living index of the current day and the next one to two days. |
aqi | Aqi | The AQI information. |
weatherSituation | WeatherSituation | Weather and city information. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Constructor | Description |
---|---|
WeatherResponse(List<DailyWeather> dailyWeather, List<HourlyWeather> hourlyWeather, List<LiveInfo> liveInfo, Aqi aqi, WeatherSituation weatherSituation) | Default constructor. |
WeatherResponse(List<DailyWeather> dailyWeather, List<HourlyWeather> hourlyWeather, List<LiveInfo> liveInfo, Aqi aqi, WeatherSituation weatherSituation)
Constructor for WeatherResponse object.
Parameters
Name | Type | Description |
---|---|---|
dailyWeather | List<DailyWeather> | Weather information of the next seven days. |
hourlyWeather | List<HourlyWeather> | Weather information in the next 24 hours. |
liveInfo | List<LiveInfo> | The living index of the current day and the next one to two days. |
aqi | Aqi | The AQI information. |
weatherSituation | WeatherSituation | Weather and city information. |
Response to the request for obtaining the Wi-Fi status, which can be obtained by calling the getWifiStatus method provided by AwarenessCaptureClient.
Name | Type | Description |
---|---|---|
status | int | Wi-Fi status of a device. |
bssid | String | Wi-Fi BSSID. |
ssid | String | Wi-Fi SSID. |
Constructor | Description |
---|---|
WiFiResponse(int status, String bssid, String ssid) | Default constructor. |
Constructor for WiFiResponse object.
Parameters
Name | Type | Description |
---|---|---|
status | int | Wi-Fi status of a device. |
bssid | String | Wi-Fi BSSID. |
ssid | String | Wi-Fi SSID. |
Beacon information.
Name | Type | Description |
---|---|---|
beaconId | String | Beacon broadcast ID. |
namespace | String | Beacon namespace. |
type | String | Beacon type. |
content | List<int> | Beacon information. |
Constructor | Description |
---|---|
BeaconData(String beaconId, String namespace, String type, List<int> content) | Default constructor. |
Constructor for BeaconData object.
Parameters
Name | Type | Description |
---|---|---|
beaconId | String | Beacon broadcast ID. |
namespace | String | Beacon namespace. |
type | String | Beacon type. |
content | List<int> | Beacon information. |
Type and confidence of a detected behavior.
Name | Type | Description |
---|---|---|
confidence | int | Confidence, indicating the possibility that a user is executing the behavior. The value ranges from 0 to 100. |
type | int | Detected behavior. |
Constructor | Description |
---|---|
DetectedBehavior(int confidence, int type) | Default constructor. |
Constructor for DetectedBehavior object.
Parameters
Name | Type | Description |
---|---|---|
confidence | int | Confidence, indicating the possibility that a user is executing the behavior. The value ranges from 0 to 100. |
type | int | Detected behavior. |
Request parameter class, which is used to pass address information to obtain weather information. The address information includes six attributes: country, province, city, district, county, and language type.
An address has five attributes: country, province, city, district, and county. The city must be set and other four attributes are optional. For example, if you want to query the weather of London, you can pass only the city attribute "London" or both the country attribute "United Kingdom" and city attribute "London".
The language type is of the locale format. For example, en_GB indicates British English. Note that the language type is mandatory and must meet the locale format language code_country/region code.
If the input address information is invalid, the weather information obtained by the getWeatherByPosition(WeatherPosition position) method is empty.
Name | Type | Description |
---|---|---|
country | String | Country name. |
province | String | Province name. |
city | String | City name, which is mandatory. |
district | String | District name. |
county | String | County name. |
locale | String | Language type of the passed address, for example, zh_CN or en_US. Note that the language type is mandatory and must meet the locale format language code_country/region code. |
Constructor | Description |
---|---|
WeatherPosition(String country, String province, String city, String district, String county, String locale) | Default contructor. |
WeatherPosition(String country, String province, String city, String district, String county, String locale)
Constructor for WeatherPosition object.
Parameters
Name | Type | Description |
---|---|---|
country | String | Country name. |
province | String | Province name. |
city | String | City name, which is mandatory. |
district | String | District name. |
county | String | County name. |
locale | String | Language type of the passed address, for example, zh_CN or en_US. Note that the language type is mandatory and must meet the locale format language code_country/region code. |
Air quality indexes. The indexes include those about the concentration of carbon monoxide (CO), nitrogen dioxide (NO2), ozone (O3), PM10, PM2.5, and sulphur dioxide (SO2), as well as the AQI. This class supports only data in China.
Name | Type | Description |
---|---|---|
aqiValue | int | AQI information. |
co | int | CO concentration index, which is the average value in 8 hours, in mg/m3. |
no2 | int | NO2 concentration index, which is the average value in 1 hour, in μg/m3. |
o3 | int | O3 concentration index, which is the average value in 1 hour, in μg/m3. |
pm10 | int | PM10 concentration index (the diameter of particles is less than or equal to 10 μm), which is the average value in 24 hours, in μg/m3. |
pm25 | int | PM2.5 concentration index (the diameter of particles is less than or equal to 2.5 μm), which is the average value in 24 hours, in μg/m3. |
so2 | int | SO2 concentration index, which is the average value in 1 hour, in μg/m3. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
City information including the city code, province name, time zone, and city/district name.
Name | Type | Description |
---|---|---|
cityCode | String | Code used in Awareness Kit to identify the state/province, city, county, and town in the world. |
name | String | Time zone of the city in Alson format. Example: Asia/shanghai |
provinceName | String | Province name, which may be set to null. |
timeZone | String | City/district/town name. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Information about a living index on a day. The indexes are about dressing, sports, temperature, car washing, tourism, and UV. This class supports only data in China.
Name | Type | Description |
---|---|---|
dateTimeStamp | int | Timestamp of a living index, which is 00:00 of the local location. |
level | String | Level of a living index. For example, a dressing index has six levels from 1 to 6. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Weather conditions in the daytime or at night, including the weather ID, wind speed, wind level, and wind direction.
Name | Type | Description |
---|---|---|
cnWeatherId | int | The weather ID. Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
weatherId | int | The weather ID. Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
windDir | String | The wind direction. The options are NE (northeast), E (east), SE (southeast), S (south), SW (southwest), W (west), N (north), and NW (northwest). |
windLevel | int | The wind level. The value ranges from 0 to 17. The value 0 indicates a breeze in China and no wind outside China. |
windSpeed | int | Obtains the wind speed (unit: km/h). |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Weather information of the current day and the next six to seven days, including the moonrise, moonset, sunrise, sunset, lowest temperature and highest temperature (Celsius and Fahrenheit), local timestamp in the early morning, month phase, weather in daytime (specified by DailySituation), and weather at night (specified by DailySituation).
Name | Type | Description |
---|---|---|
aqiValue | int | AQI information. |
dateTimeStamp | int | The timestamp of the weather of a day, which is 00:00 of the local location. |
maxTempC | int | The highest temperature (Celsius) of a day. |
maxTempF | int | The highest temperature (Fahrenheit) of a day. |
minTempC | int | The lowest temperature (Celsius) of a day. |
minTempF | int | The lowest temperature (Fahrenheit) of a day. |
moonRise | int | The moonrise of a day. |
moonSet | int | The moonset of a day. |
moonPhase | String | The Moon phase of a day. The options are New, Waxingcrescent, First, WaxingGibbous, Full, WaningGibbous, Last, and WaningCrescent. |
situationDay | DailySituation | The weather information in the daytime. |
situationNight | DailySituation | The weather information at night. |
sunRise | int | The sunrise of a day. |
sunSet | int | The sunset of a day. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Weather information in the current hour and the next 24 hours, including the weather ID, time, temperature (Celsius and Fahrenheit), rainfall probability, and whether it is in the daytime or at night.
Name | Type | Description |
---|---|---|
cnWeatherId | int | Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
dateTimeStamp | int | The timestamp in the current hour. |
isDayNight | bool | Status indicates whether it is in the daytime or at night. |
rainProbability | int | The rainfall probability, in percentage. |
tempC | int | The current temperature (Celsius). |
tempF | int | The current temperature (Fahrenheit). |
weatherId | int | Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Living index level for the day and the next one or two days, including the code and level for the current day and next one to two days. This class supports only data in China.
Name | Type | Description |
---|---|---|
code | String | The living index code. |
levelList | List<DailyLiveInfo> | Index level information of the current day and the next one to two days. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Current weather information. The information includes the weather ID, humidity, atmospheric temperature (Celsius and Fahrenheit), somatosensory temperature (Celsius and Fahrenheit), wind direction, wind level, wind speed, atmospheric pressure, UV intensity, and update time.
Name | Type | Description |
---|---|---|
cnWeatherId | int | The weather ID. Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
humidity | String | The humidity, in percentage. |
pressure | int | The atmospheric pressure, in hPa. |
realFeelC | int | The somatosensory temperature (Celsius). |
realFeelF | int | The somatosensory temperature (Fahrenheit). |
temperatureC | int | The current atmospheric temperature (Celsius). |
temperatureF | int | The current temperature (Fahrenheit). |
updateTime | int | The release time of the weather broadcast. |
uvIndex | int | The current UV intensity. |
weatherId | int | The weather ID. Weather IDs vary with the current weather. For example, 1 indicates sunny, 7 indicates cloudy, and 18 indicates rain. |
windDir | String | The wind direction. The options are NE (northeast), E (east), SE (southeast), S (south), SW (southwest), W (west), N (north), and NW (northwest). |
windSpeed | int | The wind speed (unit: km/h). |
windLevel | int | The wind level. The value ranges from 0 to 17. 0: no wind |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Current weather information, which consists of the current weather information (specified by Situation) and city information (specified by City).
Name | Type | Description |
---|---|---|
city | City | The city information of the current weather. |
situation | Situation | The current weather information. The information includes the weather ID, humidity, atmospheric temperature (Celsius and Fahrenheit), somatosensory temperature (Celsius and Fahrenheit), wind direction, wind level, wind speed, atmospheric pressure, UV intensity, and update time. |
- For details please refer to Official Huawei Awareness Flutter Plugin Documentation.
Represents filter for beacons.
Name | Type | Description |
---|---|---|
beaconNamespace | String | Beacon namespace. |
beaconType | String | Beacon type. |
beaconContent | Uint8List | Beacon context. |
beaconId | String | Beacon broadcast ID. Currently, the Eddystone-UID and iBeacon ID (combination of UUID, major, and minor values) are supported. |
Constructor | Description |
---|---|
BeaconFilter.matchByNameType(String beaconNamespace, String beaconType) | Creates a beacon filter based on the beacon namespace and type. |
BeaconFilter.matchByBeaconContent(String beaconNamespace, String beaconType, Uint8List beaconContent) | Creates a beacon filter based on the specified beacon namespace, type, and content. |
BeaconFilter.matchByBeaconId(String beaconId) | Creates a beacon filter based on a specified beacon broadcast ID. |
Creates a beacon filter based on the beacon namespace and type.
Parameters
Name | Type | Description |
---|---|---|
beaconNamespace | String | Beacon namespace. |
beaconType | String | Beacon type. |
BeaconFilter.matchByBeaconContent(String beaconNamespace, String beaconType, Uint8List beaconContent)
Creates a beacon filter based on the specified beacon namespace, type, and content.
Parameters
Name | Type | Description |
---|---|---|
beaconNamespace | String | Beacon namespace. |
beaconType | String | Beacon type. |
beaconContent | Uint8List | Beacon context. |
Creates a beacon filter based on a specified beacon broadcast ID.
Parameters
Name | Type | Description |
---|---|---|
beaconId | String | Beacon broadcast ID. Currently, the Eddystone-UID and iBeacon ID (combination of UUID, major, and minor values) are supported. |
Before building a release version of your app you may need to customize the proguard-rules.pro obfuscation configuration file to prevent the HMS Core SDK from being obfuscated. Add the configurations below to exclude the HMS Core SDK from obfuscation. For more information on this topic refer to this Android developer guide.
<flutter_project>/android/app/proguard-rules.pro
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.huawei.hms.flutter.** { *; }
# Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-dontwarn io.flutter.embedding.**
<flutter_project>/android/app/build.gradle
buildTypes {
debug {
signingConfig signingConfigs.config
}
release {
signingConfig signingConfigs.config
// Enables code shrinking, obfuscation and optimization for release builds
minifyEnabled true
// Unused resources will be removed, resources defined in the res/raw/keep.xml will be kept.
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
This plugin includes a demo project in the example folder, there you can find more usage examples.
If you have questions about how to use HMS samples, try the following options:
- Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
- Github is the official repository for these plugins, You can open an issue or submit your ideas.
- 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.
Huawei Awareness Kit Flutter Plugin is licensed under Apache 2.0 license