Last updated
Last updated
Use the code below to create a trip directly from the SDK. Set Boolean value true
to create offline trips and false
to create online trips.
Use the code below to start the trip with the previously created tripID.
Use the code below to pause the trip with the previously started trip id.
To resume the trip,
Subscribe to tripStatus
using the tripId
to get real-time trip status.
To stop receiving trip status updates, use the method below.
To retrieve the active trips, set the Boolean value to true
to get offline trips and to false
to get online trips.
Explore the Android SDK Methods for Trip API v1. Check out the latest methods if you are using Trips API v2!
Roam.createTrip(null, null, Boolean, object : RoamCreateTripCallback {
override fun onSuccess(roamTrip: RoamCreateTrip) {
// do something when create trip success
// access roam trip created timestamp with roamTrip.getCreatedAt
// access roam trip user id with roamTrip.getUserId
// access roam trip id with roamTrip.getTripId
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.createTrip(null, null, Boolean, new RoamCreateTripCallback() {
@Override
public void onSuccess(RoamCreateTrip roamTrip) {
// do something when create trip success
// access roam trip created timestamp with roamTrip.getCreatedAt
// access roam trip user id with roamTrip.getUserId
// access roam trip id with roamTrip.getTripId
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.getTripDetails("ROAM-TRIP-ID", object : RoamTripDetailCallback {
override fun onSuccess(roamTrip: RoamTripDetail) {
// do something when get trip details success
// access roam trip created timestamp with roamTrip.getCreatedAt()
// access roam trip user id with roamTrip.getUserId()
// access roam trip id with roamTrip.getTripId()
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.getTripDetails("ROAM-TRIP-ID", new RoamTripDetailCallback() {
@Override
public void onSuccess(RoamTripDetail roamTrip) {
// do something when get trip details success
// access roam trip created timestamp with roamTrip.getCreatedAt()
// access roam trip user id with roamTrip.getUserId()
// access roam trip id with roamTrip.getTripId()
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.startTrip("ROAM-TRIP-ID", "ROAM-TRIP-DESCRIPTION", object : RoamTripCallback {
override fun onSuccess(message: String) {
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.startTrip("ROAM-TRIP-ID", "ROAM-TRIP-DESCRIPTION", new RoamTripCallback() {
@Override
public void onSuccess(String message) {
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.stopTrip("ROAM-TRIP-ID", object : RoamTripCallback {
override fun onSuccess(message: String) {
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.stopTrip("ROAM-TRIP-ID", new RoamTripCallback() {
@Override
public void onSuccess(String message) {
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.pauseTrip("ROAM-TRIP-ID", object : RoamTripCallback {
override fun onSuccess(message: String) {
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.pauseTrip("ROAM-TRIP-ID", new RoamTripCallback() {
@Override
public void onSuccess(String message) {
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.resumeTrip("ROAM-TRIP-ID", object : RoamTripCallback {
override fun onSuccess(message: String) {
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.resumeTrip("ROAM-TRIP-ID", new RoamTripCallback() {
@Override
public void onSuccess(String message) {
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
//subscribe to trip status
Roam.subscribeTripStatus("ROAM-TRIP-ID")
//subscribe to trip status
Roam.subscribeTripStatus("ROAM-TRIP-ID");
//unsubscribe to trip status
Roam.unSubscribeTripStatus("ROAM-TRIP-ID")
//unsubscribe to trip status
Roam.unSubscribeTripStatus("ROAM-TRIP-ID");
Roam.getTripStatus("ROAM-TRIP-ID", object : RoamTripStatusCallback {
override fun onSuccess(roamTrip: RoamTripStatus) {
// do something when get trip details success
// access roam trip distance with roamTrip.getDistance()
// access roam trip speed with roamTrip.getSpeed()
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.getTripStatus("ROAM-TRIP-ID", new RoamTripStatusCallback() {
@Override
public void onSuccess(RoamTripStatus roamTrip) {
// do something when get trip details success
// access roam trip distance with roamTrip.getDistance()
// access roam trip speed with roamTrip.getSpeed()
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});
Roam.activeTrips(Boolean, object : RoamActiveTripsCallback {
override fun onSuccess(roamTrip: RoamTrip) {
roamTrip.activeTrips
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.getTripSummary("ROAM-TRIP-ID", object : RoamTripSummaryCallback {
override fun onSuccess(roamTrip: RoamTripSummary) {
// do something when get trip details success
// access roam trip distance covered with roamTrip.getDistanceCovered
// access roam trip route with roamTrip.getRoute
// access roam trip duration with roamTrip.getDuration
// access roam trip id with roamTrip.getTripId
}
override fun onFailure(roamError: RoamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
})
Roam.getTripSummary("ROAM-TRIP-ID", new RoamTripSummaryCallback() {
@Override
public void onSuccess(RoamTripSummary roamTrip) {
// do something when get trip details success
// access roam trip distance covered with roamTrip.getDistanceCovered
// access roam trip route with roamTrip.getRoute
// access roam trip duration with roamTrip.getDuration
// access roam trip id with roamTrip.getTripId
}
@Override
public void onFailure(RoamError roamError) {
// do something when get trip details error
// access roam error code with roamError.getCode()
// access roam error message with roamError.getMessage()
}
});