Android Driver SDK 3.0 Migration Guide
Stay organized with collections
Save and categorize content based on your preferences.
The Driver SDK for Android 3.0 release requires that you update your code
for certain operations. This guide outlines the changes and what
you'll need to do to migrate your code.
Package name change
The package name has changed from
com.google.android.libraries.ridesharing.driver
to
com.google.android.libraries.mapsplatform.transportation.driver
. Please
update references in your code.
Initializing the SDK
In earlier versions, you would initialize the Navigation SDK and then obtain
a reference to the FleetEngine
class. In Driver SDK
v3, initialize the SDK as follows:
Obtain a Navigator
object from the NavigationApi
.
NavigationApi.getNavigator(
this, // Activity
new NavigationApi.NavigatorListener() {
@Override
public void onNavigatorReady(Navigator navigator) {
// Keep a reference to the Navigator (used to configure and start nav)
this.navigator = navigator;
}
}
);
Create a DriverContext
object, populating the required fields.
DriverContext driverContext = DriverContext.builder(application)
.setProviderId(providerId)
.setVehicleId(vehicleId)
.setAuthTokenFactory(authTokenFactory)
.setNavigator(navigator)
.setRoadSnappedLocationProvider(
NavigationApi.getRoadSnappedLocationProvider(application))
.build()
Use the DriverContext
object to initialize the *DriverApi
.
Obtain the NavigationVehicleReporter
from the API object.
*VehicleReporter
extends NavigationVehicleReporter
.
Enabling and disabling location updates
In earlier versions, you would enable location updates after obtaining
a FleetEngine
reference. In Driver SDK v3, enable
location updates as follows:
To update the reporting interval, use
RidesharingVehicleReporter.setLocationReportingInterval(long, TimeUnit)
or
DeliveryVehicleReporter.setLocationReportingInterval(long, TimeUnit)
.
When the driver's shift is finished, disable location updates
and mark the vehicle as offline by calling NavigationVehicleReporter.disableLocationTracking()
.
Error Reporting with StatusListener
ErrorListener
has been removed and combined with StatusListener
,
which may be defined like the following:
class MyStatusListener implements StatusListener {
/** Called when background status is updated, during actions such as location reporting. */
@Override
public void updateStatus(
StatusLevel statusLevel,
StatusCode statusCode,
String statusMsg) {
// Status handling stuff goes here.
// StatusLevel may be DEBUG, INFO, WARNING, or ERROR.
// StatusCode may be DEFAULT, UNKNOWN_ERROR, VEHICLE_NOT_FOUND,
// BACKEND_CONNECTIVITY_ERROR, or PERMISSION_DENIED.
}
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eDriver SDK for Android has been updated to version 3.0 with package name changes and a new initialization process.\u003c/p\u003e\n"],["\u003cp\u003eLocation updates are enabled and disabled differently, using \u003ccode\u003eNavigationVehicleReporter\u003c/code\u003e methods for control.\u003c/p\u003e\n"],["\u003cp\u003eError reporting is now streamlined with \u003ccode\u003eStatusListener\u003c/code\u003e, replacing the previous \u003ccode\u003eErrorListener\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers need to update their code for compatibility with Driver SDK v3, including package references and SDK interactions.\u003c/p\u003e\n"]]],[],null,["| **Note:** The Driver SDK for Android 4.0 is now generally available. For more information, see the [Android Driver SDK 4.0 Migration Guide](/maps/documentation/transportation-logistics/on-demand-rides-deliveries-solution/trip-order-progress/migrations/driver_sdk_v4_migration_guide).\n\nThe Driver SDK for Android 3.0 release requires that you update your code\nfor certain operations. This guide outlines the changes and what\nyou'll need to do to migrate your code.\n\nPackage name change\n\nThe package name has changed from\n`com.google.android.libraries.ridesharing.driver` to\n`com.google.android.libraries.mapsplatform.transportation.driver`. Please\nupdate references in your code.\n\nInitializing the SDK\n\nIn earlier versions, you would initialize the Navigation SDK and then obtain\na reference to the `FleetEngine` class. In Driver SDK\nv3, initialize the SDK as follows:\n\n1. Obtain a `Navigator` object from the `NavigationApi`.\n\n NavigationApi.getNavigator(\n this, // Activity\n new NavigationApi.NavigatorListener() {\n @Override\n public void onNavigatorReady(Navigator navigator) {\n // Keep a reference to the Navigator (used to configure and start nav)\n this.navigator = navigator;\n }\n }\n );\n\n2. Create a `DriverContext` object, populating the required fields.\n\n DriverContext driverContext = DriverContext.builder(application)\n .setProviderId(providerId)\n .setVehicleId(vehicleId)\n .setAuthTokenFactory(authTokenFactory)\n .setNavigator(navigator)\n .setRoadSnappedLocationProvider(\n NavigationApi.getRoadSnappedLocationProvider(application))\n .build()\n\n3. Use the `DriverContext` object to initialize the `*DriverApi`.\n\n4. Obtain the `NavigationVehicleReporter` from the API object.\n `*VehicleReporter` extends `NavigationVehicleReporter`.\n\nEnabling and disabling location updates\n\nIn earlier versions, you would enable location updates after obtaining\na `FleetEngine` reference. In Driver SDK v3, enable\nlocation updates as follows:\n\nTo update the reporting interval, use\n`RidesharingVehicleReporter.setLocationReportingInterval(long, TimeUnit)` or\n`DeliveryVehicleReporter.setLocationReportingInterval(long, TimeUnit)`.\n\nWhen the driver's shift is finished, disable location updates\nand mark the vehicle as offline by calling `NavigationVehicleReporter.disableLocationTracking()`.\n\nError Reporting with StatusListener\n\n`ErrorListener` has been removed and combined with `StatusListener`,\nwhich may be defined like the following: \n\n class MyStatusListener implements StatusListener {\n /** Called when background status is updated, during actions such as location reporting. */\n @Override\n public void updateStatus(\n StatusLevel statusLevel,\n StatusCode statusCode,\n String statusMsg) {\n // Status handling stuff goes here.\n // StatusLevel may be DEBUG, INFO, WARNING, or ERROR.\n // StatusCode may be DEFAULT, UNKNOWN_ERROR, VEHICLE_NOT_FOUND, \n // BACKEND_CONNECTIVITY_ERROR, or PERMISSION_DENIED.\n }\n }"]]