awareframework_locations 0.0.2 awareframework_locations: ^0.0.2 copied to clipboard
A new flutter plugin project.
awareframework_locations #
The accelerometer measures the acceleration applied to the sensor built-in into the device, including the force of gravity.
Install the plugin into project #
- Edit
pubspec.yaml
dependencies:
awareframework_locations
- 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(force: Boolean)
enable()
disable()
isEnable()
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
)- [^Android Only]
statusGps: Boolean
true 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
) 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)- [^Android Only]
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) 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 toLogcat
. (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
)
[^Android Only]: The function is supported on Android only. iOS does not support the function.
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 mathod(){
/// start
sensor.start();
/// set observer
sensor.onLocationChanged.listen((Map<String,dynamic> result){
setState((){
// Your code here
});
});
/// stop
sensor.stop();
/// sync
sensor.sync(true);
// make a sensor care by the following code
var card = new LocationCard(sensor:sensor);
// NEXT: Add the card instance into a target Widget.
}
License #
Copyright (c) 2018 AWARE Mobile Context Instrumentation Middleware/Framework (http://www.awareframework.com)
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
http://www.apache.org/licenses/LI 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.