Driver Behaviour
This guide will teach you how to start analyzing driver behaviour using Maps SDK for Flutter.
How It Works
The example app demonstrates the following key features:
- Initializing a map.
- Configuring the map to use live data from the device's GPS.
- Starting and stopping a driver behaviour analysis.
- Viewing recorded driver behaviour sessions.
UI and Map Integration
The following code demonstrates how to build a user interface featuring a GemMap
widget and an app bar. The app bar includes buttons for starting and stopping recordings, as well as following the user's position. After successfully completing a recording, a View Analysis
button appears at the bottom of the screen. Clicking this button navigates the user to the AnalysesPage
.
Analyses Page
Utility Functions
- Android
- iOS
Add the following code to the android/app/src/main/AndroidManifest.xml
file, within the <manifest>
block:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
This example uses the Permission Handler package. Be sure to follow the setup guide.
Add the following to ios/Runner/Info.plist
inside the <dict>
:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is needed for map localization and navigation</string>
This example uses the Permission Handler package. Follow the official setup instructions. Add this to your ios/Podfile
:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'PERMISSION_LOCATION=1',
]
end
end
end