public abstract class ZendriveBroadcastReceiver
extends android.content.BroadcastReceiver
setup
call.
The application intent service subclass is not allowed to directly handle intents by overriding
the onHandleIntent method of the IntentService. 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.Constructor and Description |
---|
ZendriveBroadcastReceiver() |
Modifier and Type | Method and Description |
---|---|
abstract void |
onAccident(android.content.Context context,
AccidentInfo accidentInfo)
Called when Zendrive SDK detects an accident.
|
abstract void |
onDriveAnalyzed(android.content.Context context,
AnalyzedDriveInfo analyzedDriveInfo)
Called when the Zendrive SDK has analyzed a drive.
|
abstract void |
onDriveEnd(android.content.Context context,
EstimatedDriveInfo estimatedDriveInfo)
Called when the Zendrive SDK ends a drive.
|
abstract void |
onDriveResume(android.content.Context context,
DriveResumeInfo driveResumeInfo)
Called when the Zendrive SDK resumes a drive after a gap.
|
abstract void |
onDriveStart(android.content.Context context,
DriveStartInfo startInfo)
Called when the Zendrive SDK starts a drive.
|
abstract void |
onLocationPermissionsChange(android.content.Context context,
boolean granted)
This method is called only in apps built with the Runtime Permissions
model of Android 6.0 (Marshmallow)(API 23) and above.
|
abstract void |
onLocationSettingsChange(android.content.Context context,
ZendriveLocationSettingsResult locationSettingsResult)
This method is called when high accuracy location related settings are changed on the
device.
|
void |
onReceive(android.content.Context context,
android.content.Intent intent)
This method is called when the BroadcastReceiver is receiving an Intent
broadcast.
|
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getPendingResult, getResultCode, getResultData, getResultExtras, getSendingUserId, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setPendingResult, setResult, setResultCode, setResultData, setResultExtras
public abstract void onDriveStart(android.content.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(android.content.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(Context, AnalyzedDriveInfo)
callback when the drive is
completely analyzed. Applications should update everything received
here with values from AnalyzedDriveInfo
.public abstract void onDriveAnalyzed(android.content.Context context, AnalyzedDriveInfo analyzedDriveInfo)
ZendriveDriveType
is not
ZendriveDriveType.INVALID
.
This is always called after onDriveEnd(Context, 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(Context, 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(Context, EstimatedDriveInfo)
callback. Applications shouldpublic abstract void onDriveResume(android.content.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 abstract void onAccident(android.content.Context context, AccidentInfo accidentInfo)
context
- The Context in which the receiver is running.accidentInfo
- Information about the accident.public abstract void onLocationPermissionsChange(android.content.Context context, boolean granted)
context
- The Context in which the receiver is running.granted
- indicates if runtime location permission is granted or denied for the
application.
True indicates that the permission is granted.
False indicates that the permission is denied. If false, the
appropriate action here is for the application to prompt thepublic abstract void onLocationSettingsChange(android.content.Context context, ZendriveLocationSettingsResult locationSettingsResult)
ZendriveLocationSettingsResult
to determine how
to prompt the user to fix settings on the device.
Each call provides full information about the state of high accuracy location settings
on the device. Successive callbacks are not incremental in providing information.
Hence, the app can just consider the info in the most recent call of this method to
surface errors to the user and ignore older calls.context
- The Context in which the receiver is running.locationSettingsResult
- indicates the status of location settings on the device andpublic final void onReceive(android.content.Context context, android.content.Intent intent)
android.content.BroadcastReceiver
Context.registerReceiver(BroadcastReceiver,
IntentFilter, String, android.os.Handler)
. When it runs on the main
thread you should
never perform long-running operations in it (there is a timeout of
10 seconds that the system allows before considering the receiver to
be blocked and a candidate to be killed). You cannot launch a popup dialog
in your implementation of onReceive().
If this BroadcastReceiver was launched through a <receiver> tag,
then the object is no longer alive after returning from this
function. This means you should not perform any operations that
return a result to you asynchronously -- in particular, for interacting
with services, you should use
Context.startService(Intent)
instead of
Context.bindService(Intent, ServiceConnection, int)
. If you wish
to interact with a service that is already running, you can use
BroadcastReceiver.peekService(android.content.Context, android.content.Intent)
.
The Intent filters used in Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)
and in application manifests are not guaranteed to be exclusive. They
are hints to the operating system about how to find suitable recipients. It is
possible for senders to force delivery to specific recipients, bypassing filter
resolution. For this reason, onReceive()
implementations should respond only to known actions, ignoring any unexpected
Intents that they may receive.
onReceive
in class android.content.BroadcastReceiver
context
- The Context in which the receiver is running.intent
- The Intent being received.