Upgrading Android SDKs

SDK patch upgrades (version x.y.a to x.y.b) are guaranteed to not break any APIs. For other upgrades, there maybe some API changes that would need your code to be modified.

Upgrading to v1.5.x

If you are currently using DriverSDK with an older version and wish to migrate to 1.5.+ - this guide is for you.

It covers the updated API Callback structure, a few modifications in HTTransmitterService APIs and updated broadcast parameters in DriverSDK v1.5.+.

Modified Callback Structure

With DriverSDK v1.5.x release, callback structure for HTTransmitterService's APIs has been modified. The updated API callback structure is as follows:

Callback Method Description
onSuccess(Response Object) Called on successful response from the server.
onOfflineSuccess() Called on offline success and cached request will be pushed to server when the device comes online.
onError(Exception exception) Called on error either in API parameters/SDK state or on the server.

The APIs affected by this change are:

  • startTrip(HTTripParams htTripParams, HTTripStatusCallback callback)
  • completeTask(String taskID, HTCompleteTaskStatusCallback callback)
  • endTrip(HTTripStatusCallback callback)
  • startShift(HTShiftParams htShiftParams, HTShiftStatusCallback callback)
  • endShift(HTShiftStatusCallback callback)
  • refreshTrip(String tripID, HTTripStatusCallback callback)
  • refreshTask(String taskID, HTTaskStatusCallback callback)
  • cancelTask(String taskID, HTTaskStatusCallback callback)
  • endTrip(String tripID, HTTripStatusCallback callback)
  • endAllTrips(String driverID, HTTripStatusCallback callback)
HTTransmitterService transmitterService = HTTransmitterService.getInstance(getApplicationContext());
transmitterService.startTrip(htTripParams, new HTTripStatusCallback() {
    @Override
    public void onError(Exception error) {
        // Handle startTrip API error here
    }

    @Override
    public void onSuccess(HTTrip trip) {
        // Handle startTrip API success to server here
    }

    @Override
    public void onOfflineSuccess() {
        // Handle offline startTrip API success here (startTrip request has been
        // cached, starting the DriverSDK and it will be synced with server once
        // the device comes online)
    }
});

Modified APIs

Old API New API Description
endAllTrips(String driverID, HTEndAllTripsCallback callback) endAllTrips(String driverID, HTTripStatusCallback callback) Call this method to end all trips for a given driverID.
refreshTripForTripID (String tripID, HTTripStatusCallback callback) refreshTrip(String tripID, HTTripStatusCallback callback) Call this method to fetch updated Trip info for a given tripID.

Deprecated APIs

Deprecated API Use Description
endTrip(String tripID, HTTripStatusCallback callback) endTrip(HTTripStatusCallback callback) Method to end the trip for currently active driver.

Deleted APIs

Deleted API Description
getActiveDriverID() Get Active DriverID API has been removed from the SDK. In order to get currently active driver, you can call isDriverLive() and getDriverID() to get currently active driverID. Refer to Driver SDK Methods for more info.

Modified Broadcasts

With DriverSDK v1.5.x, LocationSevice started broadcast intent (TransmitterConstants.HT_ON_LOCATION_SERVICE_STARTED_INTENT) and LocationService stopped broadcast intent (TransmitterConstants.HT_ON_DRIVER_NOT_ACTIVE_INTENT) will contain DriverID (TransmitterConstants.HT_DRIVER_ID_KEY) as intent extras. Refer to Intents section in Methods references guide for more details on usage.

Upgrading to v1.4.x

If you are currently using DriverSDK with an older version and wish to migrate to 1.4.+ - this guide is for you.

It covers the modifications in HTTransmitterService APIs and updated broadcast in DriverSDK v1.4.+.

Added Broadcasts

The DriverSDK v1.4.x has the capability for a Backend-start where a Trip or a Shift can be started on the backend and provided the DriverSDK is online, LocationService would start on the DriverSDK. So when the LocationSevice starts, TransmitterConstants.HT_ON_LOCATION_SERVICE_STARTED_INTENT broadcast will be fired and this can be used to detect starting of a Trip or Shift on the DriverSDK.

New APIs

Method Description
connectDriver(Context context, String driverID) Method to establish DriverSDK connection for a DriverID. Call this method when the DriverSDK connection needs to established, to be able to implement backend-start calls. (Preferably in the onResume() method of your app's Launcher Activity)
endAllTrips(String driverID, HTEndAllTripsCallback callback) Call this method to end all trips for a given driverID.

Modified APIs

Old API New API Description
completeTrip() endTrip(String tripID, HTTripStatusCallback callback) Call endTrip method with tripID and HTTripStatusCallback as parameters to end a Trip.
startDriverForTrip startLocationService(driverID, HTStartDriverStatusCallback) Call this API to start LocationService for a Trip already started on the backend, otherwise the LocationService would stop when it syncs with the backend.
startDriverForTask() startLocationService(driverID, HTStartDriverStatusCallback) Call this API to start LocationService for a Task already started on the backend, otherwise the LocationService would stop when it syncs with the backend.
startDriverForTask() startLocationService(driverID, HTStartDriverStatusCallback) Call this API to start LocationService for a Shift already started on the backend, otherwise the LocationService would stop when it syncs with the backend.

Deleted APIs

  • startTask()

Start Task API has been removed from the SDK. In order to start a task, you can use startTrip API with taskID as param. Refer to our Start a trip in Android doc for this.

  • DriverSDK State APIs

The DriverSDK had been caching active trips/tasks/shifts but this ended up with State mismatch issues. Considering such issues, DriverSDK is now stateless and the following APIs have been removed:

isTripActive()
getActiveTripID()
isTaskActive(String taskID)
getActiveTaskIDs(String driverID)
isShiftActive()
getDriverIDForActiveShift()
  • completeAllActiveTasks API

CompleteAllTasks API has been removed from the SDK. Call completeTask API in order to complete a task.

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""