Skip to content

DriveMotionBroadcastReceiver

DriveMotionBroadcastReceiver is an abstract class for users to receive trip changes through broadcast.

Implement Application's Receiver For DriveMotion Broadcast

For how to configure the implementation class of DriveMotionBroadcastReceiver, please refer to Initialize the SDK. And no matter whether DriveDetectionMode is AUTO or MANUAL, the application can learn the dynamics of the trip through this broadcast.

Note

Broadcasts sent by the SDK can be received only after the receiver is correctly configured when initialize.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    public class AppDriveMotionBroadcastReceiver extends DriveMotionBroadcastReceiver {

        @Override
        public void onDriveStart(DriveStartEvent driveStartEvent) {
            // Do something
        }

        @Override
        public void onDriveEnd(DriveEndEvent driveEndEvent) {
            // Do something
        }

        @Override
        public void onDriveEventDetected(DriveEvent driveEvent) {
            // Do something
        }

        @Override
        public void onDriveScoreUpdated(DriveScoreEvent driveScoreEvent) {
            // Do something
        }

        @Override
        public void onDriveAnalyzed(DriveAnalyzedEvent driveAnalyzedEvent) {
            // Do something
        }

    }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
    class AppDriveMotionBroadcastReceiver : DriveMotionBroadcastReceiver() {
        override fun onDriveStart(driveStartEvent: DriveStartEvent) {
            // Do something
        }

        override fun onDriveEnd(driveEndEvent: DriveEndEvent) {
            // Do something
        }

        override fun onDriveEventDetected(driveEvent: DriveEvent) {
            // Do something
        }

        override fun onDriveScoreUpdated(driveScoreEvent: DriveScoreEvent) {
            // Do something
        }

        override fun onDriveAnalyzed(driveAnalyzedEvent: DriveAnalyzedEvent) {
            // Do something
        }
    }

Broadcast Event

  • DriveStartEvent: When the trip starts, DriveMotion will broadcast this event, which mainly includes tripId, start time and start location.
  • DriveEvent: After the trip starts, if DriveMotion detects a safety event (such as: hard acceleration, hard braking, sharp turns, etc.), it will broadcast the event. It contains a specific safety event.
  • DriveScoreEvent: After the trip starts, If DriveMotion has calculated the score of the current trip, this event will be broadcast. It will include the latest summary information, the latest score, and information about safety events in current trip.
  • DriveAnalyzedEvent: After the trip ends, DriveMotion will first send the event for the final analysis of the trip. Compared with DriveScoreEvent, it represents the final itinerary information, so it has the trajectory of the entire itinerary.
  • DriveEndEvent: After the trip ends and DriveAnalyzedEvent is broadcast, DriveMotion will broadcast this event, which mainly includes tripId, end time, end location and trip status.