Build Status

The locations sensor provides the best location estimate for the users’ current location, automatically.

Install the plugin into project

  1. Edit pubspec.yaml
  1. Import the package on your source code
import 'package:awareframework_locations/awareframework_locations.dart';
import 'package:awareframework_core/awareframework_core.dart';

Public functions

Locations Sensor

  • start()
  • stop()
  • sync(boolean force)
  • enable()
  • disable()
  • isEnable()
  • setLabel(String label)

Configuration Keys

  • geoFences: String? Geofences that are going to be checked on the location updates. If within the range of these fences, then the location is accepted as a permitted update. If null, all location updates are accepted as permitted. String follows the regex in format (?:latitude),(?:longitude)[ \t;]+. (default = null)
  • statusGps: Booleantrue or false to activate or deactivate GPS locations. (default = true) Android Only
  • statusNetwork: Boolean true or false to activate or deactivate Network locations. (default = true) Android Only
  • statusPassive: Boolean true or false to activate or deactivate passive locations. (default = true) Android Only
  • frequencyGps: Int how frequent to check the GPS location, in seconds. By default, every 180 seconds. Setting to 0 (zero) will keep the GPS location tracking always on. (default = 180)
  • minGpsAccuracy: Int the minimum acceptable accuracy of GPS location, in meters. By default, 150 meters. Setting to 0 (zero) will keep the GPS location tracking always on. (default = 150)
  • frequencyNetwork: Int how frequently to check the network location, in seconds. By default, every 300 seconds. Setting to 0 (zero) will keep the network location tracking always on. (default = 300) Android Only
  • minNetworkAccuracy: Int the minimum acceptable accuracy of network location, in meters. By default, 1500 meters. Setting to 0 (zero) will keep the network location tracking always on. (default = 1500) Android Only
  • expirationTime: Long the amount of elapsed time, in seconds, until the location is considered outdated. By default, 300 seconds. (default = 300)
  • saveAll: Boolean Whether to save all the location updates or not. (default = false)
  • enabled: Boolean Sensor is enabled or not. (default = false)
  • debug: Boolean enable/disable logging to Logcat. (default = false)
  • label: String Label for the data. (default = "")
  • deviceId: String Id of the device that will be associated with the events and the sensor. (default = "")
  • dbEncryptionKey Encryption key for the database. (default = null)
  • dbType: Engine Which db engine to use for saving data. (default = Engine.DatabaseType.NONE)
  • dbPath: String Path of the database. (default = "aware_locations")
  • dbHost: String Host for syncing the database. (default = null)

Data Representations

The data representations is different between Android and iOS. Following links provide the information.

Example usage

// init config
var config = LocationsSensorConfig()
  ..debug = true
  ..label = "label";

// init sensor
var sensor = new LocationsSensor(config);

void method(){
    /// start 
    /// set observer
    sensor.onLocationChanged.listen(LocationData data){
        // Your code here
    /// stop
    /// sync
    // make a sensor care by the following code
    var card = new LocationCard(sensor:sensor);
    // NEXT: Add the card instance into a target Widget.


Copyright (c) 2018 AWARE Mobile Context Instrumentation Middleware/Framework (

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at CENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.




Built-in types and core primitives for a Flutter application. [...]


Support for asynchronous programming, with classes such as Future and Stream. [...]
Classes and utilities that supplement the collection support in dart:core. [...]
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
Built-in types, collections, and other core functionality for every Dart program. [...]
Interact with developer tools such as the debugger and inspector. [...]
Mathematical constants and functions, plus a random number generator. [...]
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]


File, socket, HTTP, and other I/O support for non-web applications. [...]
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]