2.3.3 • Published 3 years ago

com.zendrive.phonegap v2.3.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

zendrive-sdk-phonegap-plugin

This is the official plugin for Zendrive in Apache Cordova/PhoneGap!

Zendrive is commited to improving driving and transportation for everyone through better data and analytics. You can integrate zendrive-sdk-phonegap-plugin in your application to get Zendrive's driver centric analytics and insights for your fleet.

var processStartOfDrive = function(zendriveDriveStartInfo) { alert("processStartOfDrive: " + JSON.stringify(zendriveDriveStartInfo)); }; var processEndOfDrive = function(zendriveDriveInfo) { alert("processEndOfDrive: " + JSON.stringify(zendriveDriveInfo)); }; var processLocationDenied = function() { alert("Location denied, please enable location services to keep Zendrive working"); };

var zendriveCallback = new Zendrive.ZendriveCallback(processStartOfDrive, processEndOfDrive, processLocationDenied);

Zendrive.setup(config, zendriveCallback, function() { alert("Setup done!"); }, function (error) { alert("Setup failed: " + error); } );

<ul style="list-style-position: inside">
<li>If you don't have the ZENDRIVE_APPLICATION_KEY, sign up on the Zendrive Developer Portal and get the key.</li>
<li>The <DRIVER_ID> is an ID for the driver currently using the application. Each driver using the application needs a unique ID</li>
</ul>
<p>See the <a target="_blank" href="http://zendrive-root.bitbucket.org/phonegap/docs/jsdoc-2.0.0/Zendrive.html#.setup">SDK Reference</a> for more details about setup.</p>

<h4>Manual Trip Tagging</h4>
<p>The Zendrive SDK works in the background and automatically detects trips and tracks driving behaviour. However, some applications already have knowledge of point-to-point trips made by the driver using the application. For example - a taxi metering app. If your application has this knowledge, it can indicate that to the Zendrive SDK explicitly.</p>

Zendrive.startDrive(<TRACKING_ID>); // A non empty <TRACKING_ID> must be specified Zendrive.stopDrive(<TRACKING_ID>); // The <TRACKING_ID> should be same as passed in startDrive

<p>The &lt;TRACKING_ID&gt; can be used to find Zendrive trips with this ID in the <a href="https://developers.zendrive.com/docs/api/" target="_blank">Zendrive Analytics API</a>. See the <a href="http://zendrive-root.bitbucket.org/phonegap/docs/jsdoc-2.0.0/Zendrive.html#.startDrive" target="_blank">SDK Reference</a> for more details about these calls.</p>

<h4>Driving Sessions</h4>
<p>Some applications want to track multiple point-to-point trips together as a single entity. For example, a car rental app may want to track all trips made by a user between a rental car pickup and dropoff as a single entity. This can be done using sessions in the Zendrive SDK.
Sessions can be used in the Zendrive SDK by making the following calls.</p>

Zendrive.startSession(<SESSION_ID>); // A non empty must be specified Zendrive.stopSession();

<p>All trips within a session are tagged with the session id. The session id can then be used to lookup Zendrive trips belonging to this session using the <a href="https://developers.zendrive.com/docs/api/" target="_blank">Zendrive Analytics API</a>. See the <a href="http://zendrive-root.bitbucket.org/phonegap/docs/jsdoc-2.0.0/Zendrive.html#.startSession" target="_blank">SDK Reference</a> for more details about these calls.</p>

<h4>Controlling Automatic Drive Detection</h4>
<p>The Zendrive SDK works in the background and automatically detects trips and tracks driving behaviour. If needed, an application can change this behaviour. For example, a rideshare app may want to automatically track all drives made by a driver only when the driver is on-duty and not collect any data for off-duty drives.</p>
<p>The application can specify the required behaviour via an additional argument during setup of the Zendrive SDK. ZendriveDriveDetectionModeAutoOFF disables automatic drive detection in the SDK.</p>

// ZendriveDriveDetectionMode.ZendriveDriveDetectionModeAutoOFF disables automatic drive detection in the SDK. config.driveDetectionMode = Zendrive.ZendriveDriveDetectionMode.ZendriveDriveDetectionModeAutoOFF;

<p>The application can also temporarily enable Zendrive's auto drive-detection. This can be done by setting the ZendriveDriveDetectionMode.</p>
<p> To Turn on automatic drive detection in the SDK.</p>

Zendrive.setDriveDetectionMode(Zendrive.ZendriveDriveDetectionMode.ZendriveDriveDetectionModeAutoON);

<p> To Turn off automatic drive detection in the SDK.</p>

Zendrive.setDriveDetectionMode(Zendrive.ZendriveDriveDetectionMode.ZendriveDriveDetectionModeAutoOFF);

<h4>Disable the SDK</h4>
<p>To disable the SDK at any point in the application, you can invoke this method. The Zendrive SDK goes completely silent after this call and does not track any driving behaviour again.</p>

Zendrive.teardown();

<p>The application needs to re-initalize the SDK to start tracking driving behaviour.</p>

<br/>
<br/>
<br/>