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.

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

Android Notification Configuration(Optional)

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

1
AndroidNotificationConfig androidConfig = AndroidNotificationConfig();
2
await 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.

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

Location Configuration(Optional)

Adjust location tracking settings according to your preferences.

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

Data Tracking Configuration(Optional)

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

1
DataTrackingConfig dataTrackingConfig = DataTrackingConfig();
2
await 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.

1
class ConcreteTrackingListener implements OnTrackingDataCallBack {
2
@override
3
void onLocationSuccess(NBLocation location) {
4
print('Location update successful: $location');
5
// Handle successful location update logic here
6
}
7
8
@override
9
void onLocationFailure(String message) {
10
print('Location update failed: $message');
11
// Handle location update failure logic here
12
}
13
14
@override
15
void onTrackingStart(String assetId) {
16
print('Tracking started for asset: $assetId');
17
// Handle tracking start logic here
18
}
19
20
@override
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
28
ConcreteTrackingListener concreteListener = ConcreteTrackingListener();
29
30
// Add a listener
31
assetTracking.addDataListener(concreteListener);
32
33
// Remove a listener
34
assetTracking.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.

© 2024 NextBillion.ai all rights reserved.