Custom Configurations

Tailor the Flutter Tracking SDK to your specific needs by implementing custom configurations. Customize default settings, notification preferences for Android and iOS, location tracking parameters, and data tracking options as described below:

Default Configuration(Optional)

Create a default configuration object if you want to customize default settings within the SDK.

1DefaultConfig defaultConfig = DefaultConfig();
2await assetTracking.setDefaultConfig(config: defaultConfig);

Android Notification Configuration(Optional)

Customize Android notification settings to tailor the appearance and behavior of notifications on Android devices.

1AndroidNotificationConfig androidConfig = AndroidNotificationConfig();
2await assetTracking.setAndroidNotificationConfig(config: androidConfig);

iOS Notification Configuration(Optional)

Configure iOS notification settings based on your application’s requirements for optimal user experience on iOS devices.

1IOSNotificationConfig iosConfig = IOSNotificationConfig();
2await assetTracking.setIOSNotificationConfig(config: iosConfig);

Location Configuration(Optional)

Adjust location tracking settings according to your preferences.

1LocationConfig locationConfig = LocationConfig();
2await assetTracking.setLocationConfig(config: locationConfig);

Data Tracking Configuration(Optional)

Customize data tracking settings as needed to gather information about asset activity and usage.

1DataTrackingConfig dataTrackingConfig = DataTrackingConfig();
2await assetTracking.setDataTrackingConfig(config: dataTrackingConfig);

Event Listeners

Register event listeners to receive updates on tracking activities. Implement the following concrete listener class to handle location updates, tracking start and stop events.

1class ConcreteTrackingListener implements OnTrackingDataCallBack {
2
3 void onLocationSuccess(NBLocation location) {
4 print('Location update successful: $location');
5 // Handle successful location update logic here
6 }
7
8
9 void onLocationFailure(String message) {
10 print('Location update failed: $message');
11 // Handle location update failure logic here
12 }
13
14
15 void onTrackingStart(String assetId) {
16 print('Tracking started for asset: $assetId');
17 // Handle tracking start logic here
18 }
19
20
21 void onTrackingStop(String assetId) {
22 print('Tracking stopped for asset: $assetId');
23 // Handle tracking stop logic here
24 }
25}
26
27// Create an instance of the concrete listener
28ConcreteTrackingListener concreteListener = ConcreteTrackingListener();
29
30// Add a listener
31assetTracking.addDataListener(concreteListener);
32
33// Remove a listener
34assetTracking.removeDataListener(concreteListener);

Implement these configurations and event listeners to tailor the Flutter Tracking SDK to your application's unique requirements, providing flexibility and control over tracking behavior and notifications.