public abstract class ZendriveBroadcastReceiver extends BroadcastReceiver
To receive these callbacks - the application should subclass this class and implement the
abstract handlers for SDK callbacks. The subclass should then be registered with the Zendrive SDK
via the SDK setup
call.
The application broadcast receiver subclass is not allowed to directly handle intents by overriding the onReceive method of the BroadcastReceiver. The raw SDK intents are not guaranteed to be backward compatible across versions. The application should implement the abstract handler methods in this class to receive the callbacks.
BroadcastReceiver.PendingResult
Constructor and Description |
---|
ZendriveBroadcastReceiver() |
Modifier and Type | Method and Description |
---|---|
abstract void |
onAccident(Context context,
AccidentInfo accidentInfo)
Called when Zendrive SDK detects an accident.
|
void |
onBusinessHoursChanged(Context context,
ZendriveShiftDetail zendriveShiftDetail)
Called whenever the business hours are fetched and updated by the Zendrive SDK.
|
abstract void |
onDriveAnalyzed(Context context,
AnalyzedDriveInfo analyzedDriveInfo)
Called when the Zendrive SDK has analyzed a drive.
|
abstract void |
onDriveEnd(Context context,
EstimatedDriveInfo estimatedDriveInfo)
Called when the Zendrive SDK ends a drive.
|
abstract void |
onDriveResume(Context context,
DriveResumeInfo driveResumeInfo)
Called when the Zendrive SDK resumes a drive after a gap.
|
abstract void |
onDriveStart(Context context,
DriveStartInfo startInfo)
Called when the Zendrive SDK starts a drive.
|
void |
onPotentialAccident(Context context,
AccidentInfo accidentInfo)
This is an experimental feature, disabled by default.
|
void |
onReceive(Context context,
Intent intent) |
abstract void |
onZendriveSettingsConfigChanged(Context context,
boolean errorsFound,
boolean warningsFound)
This method is called when the Zendrive SDK detects a change in device settings that affects
trip detection or the normal functioning of the SDK.
|
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, getSentFromPackage, getSentFromUid, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
public abstract void onDriveStart(Context context, DriveStartInfo startInfo)
context
- The Context in which the receiver is running.startInfo
- Information about the drive that is available at drive start.public abstract void onDriveEnd(Context context, EstimatedDriveInfo estimatedDriveInfo)
context
- The Context in which the receiver is running.estimatedDriveInfo
- Information about the drive. This contains info about the drive
that is available immediately at the end of a drive. Additional or
improved info about the drive will be provided via the onDriveAnalyzed(android.content.Context, com.zendrive.sdk.AnalyzedDriveInfo)
callback when the drive is completely analyzed.
Applications should update everything received here with values
from AnalyzedDriveInfo
.public abstract void onDriveAnalyzed(Context context, AnalyzedDriveInfo analyzedDriveInfo)
This will only be called for drives where ZendriveDriveType
is not
ZendriveDriveType.INVALID
.
This is always called after onDriveEnd(android.content.Context, com.zendrive.sdk.EstimatedDriveInfo)
for a
particular DriveInfo.driveId
. These callbacks are always invoked on the application
in the order of occurence of drives. Typically there can be a delay of upto a few seconds
between the invocation of onDriveEnd(android.content.Context, com.zendrive.sdk.EstimatedDriveInfo)
and this callback.
Sometimes this delay can be very large due to unavailability of network or other abnormal
conditions. Applications must factor in this delay when using these callbacks.
context
- The Context in which the receiver is running.analyzedDriveInfo
- Completely analyzed information about the drive with driving score
and all the events. This may contain additional or improved data
over the EstimatedDriveInfo
provided in the onDriveEnd(android.content.Context, com.zendrive.sdk.EstimatedDriveInfo)
callback. Applications should replace all information
returned in onDriveEnd(android.content.Context, com.zendrive.sdk.EstimatedDriveInfo)
with the information returned here.public abstract void onDriveResume(Context context, DriveResumeInfo driveResumeInfo)
context
- The Context in which the receiver is running.driveResumeInfo
- Information that is available about the drive that is now resumed.public void onPotentialAccident(Context context, AccidentInfo accidentInfo)
onAccident(android.content.Context, com.zendrive.sdk.AccidentInfo)
callback. Contact support@zendrive.com to enable the feature.
If the callback is invalidated by onAccident
, the AccidentInfo.confidence
will be set to ZendriveAccidentConfidence.INVALID
and
AccidentInfo.confidenceNumber
will be set to 0.context
- The Context in which the receiver is running.accidentInfo
- Information about the accident.public abstract void onAccident(Context context, AccidentInfo accidentInfo)
context
- The Context in which the receiver is running.accidentInfo
- Information about the accident.public void onBusinessHoursChanged(Context context, ZendriveShiftDetail zendriveShiftDetail)
NOTE: To get the updated business hours instantly, the application must call
Zendrive.refreshBusinessHours(Context, ZendriveRefreshBusinessHoursCallback)
.
context
- The Context in which the receiver is running.zendriveShiftDetail
- Information about the updated business hours represented by the
ZendriveShiftDetail
object.public abstract void onZendriveSettingsConfigChanged(Context context, boolean errorsFound, boolean warningsFound)
The user should call
Zendrive.getZendriveSettings(Context, ZendriveSettingsCallback)
to get detailed error information.
context
- The context in which the receiver is running.errorsFound
- True if errors are present that affect trip detection.
False if errors are resolved.warningsFound
- True if warnings are present that affect the normal
functioning of the SDK. False otherwise.public final void onReceive(Context context, Intent intent)
onReceive
in class BroadcastReceiver