Customization

Now, let’s see the other functionalities that could be performed.

  • Configuring Location updates

    What if you want to set your own way of getting the location updates from the operator?

TripBuilder builder = new TripBuilder("Tracking_Id");
builder.withInterval(5000); //Location update set to 5 seconds.
builder.withDistance(10); //Location update set to 10 meters.
Teliver.startTrip(builder.build());

You can also customize more with the method builder.withLocationRequest(locationrequest) Where you can pass the object of LocationRequest class of playservice.

  • Listeners for Trip

    You can add listeners for the trips that you started by simply calling the below snippet.

Teliver.setTripListener(new TripListener() {
                    @Override
                    public void onTripStarted(Trip tripDetails) {
                        //This method is called when a trip has been started.
                    }

                    @Override
                    public void onLocationUpdate(Location location) {
                    //This method is called when an location update is made.

                    }

                    @Override
                    public void onTripEnded(String trackingID) {
                        //This method is called when a trip has been Ended.

                    }

                    @Override
                    public void onTripError(String reason) {
                        //This method is called when a trip has faced error on starting.

                    }
                });
  • Custom marker options

    What if you want to set your own image, title and snippet for marker?

MarkerOption option = new MarkerOption("Tracking_Id");
option.setMarkerTitle("Your_Title");
option.setMarkerSnippet("Your_Snippet");
option.setIconMarker(R.drawable.your_drawable); //You can also set your Bitmap object.

Teliver.startTracking(new TrackingBuilder(option).withTitle("Track").build());

Note: withTitle() method here sets your page title on tracking page

  • Multiple Operator Tracking

    What if you want to track multiple operators?

List<MarkerOption> markerOptionList = new ArrayList<>();
String[] ids = {"operator_1","operator_2","operator_3"};
for(String id:ids){
MarkerOption option=new MarkerOption(id);
markerOptionList.add(option);
}

Teliver.startTracking(new TrackingBuilder(markerOptionList).build());

Note: Multiple Operator Tracking allowed only on paid plans

  • Tracking on your map

    What if you want tracking to happen on your own view rather than ours?

Teliver.startTracking(new TrackingBuilder(option).withYourMap(googleMap).build());

This snippet enables the entire tracking system in order to take place in your own map object. Just pass the object created and you are done.

  • Get Location updates

    What if you want just the location updates of each operator?

Teliver.startTracking(new TrackingBuilder(option).withListener(new TrackingListener(){
@Override
public void onTrackingStarted(String trackingId) {
//This method is called when the operator initiates the trip by startTrip method.
}

@Override
public void onLocationUpdate(String trackingId, TLocation location) {
//This method is called when there is a updates in the location.
}

@Override
public void onTrackingEnded(String trackingId) {
//This method is called when tracking has stopped by calling the method stopTracking.
}

@Override
public void onTrackingError(String reason) {
//This method is called when there is error on tracking.
}
})).build());
  • Tag Location

    What if you want to tag a particular location for future reference?

From your Operator app use the following snippet to tag a location of Operator.

Teliver.tagLocation("Tracking_Id", "your order is delivered");

Last updated