teliver-android-food-delivery
Food Delivery
Teliver is the right path for food deliveries to be tracked through a mobile App. Customer is kept informed of where the food is and also notified with custom events require by deliveries.
ADDING TELIVER SDK TO YOUR DRIVER APP

This is how it's going to get easier, to add Live Tracking in your food delivery Android application, just integrate Teliver SDK with the following simple steps.

  • The TeliverSDK is hosted on Bintray and is available on JCenter.

  • Add the dependency right into your build gradle file compile.

compile "com.teliver.sdk:TeliverSdk:1.0.12"

  • Sync the gradle project then add the necessary code to initialize TeliverSDK in your app.

INITIALIZE TELIVER SDK IN YOUR APP

Congratulations! If you successfully completed the previous step of integration. Now lets proceed to the next step of initializing.

To initialize you need a "TELIVER KEY". Which is a unique key needed for identifying your application and to get the core of Teliver to work.

To get the key,

  • Login/Register to Teliver , you can find 'TELIVER KEY' under android integration tab.

integration-teliver-key
  • Initiate the Teliver SDK by adding the following code in your Application class.

Teliver.init(this,"TELIVER_KEY");

(Note: Write TLog.setVisible(true) in your Activity to enable logging during Development.)

START A TRIP AT DRIVER SIDE

Once all the above steps are fullfilled now we are ready to start a trip. To start a trip on the driver side use below snippet of code.

private void startTrip( ) {

  Teliver.startTrip(tripBuilder.withUserPushObject(pushData).build( ));

  Teliver.setListener(new TripListener( ) {

@Override
  public void onTripStarted(Trip tripDetails) {
  }

@Override
  public void onTripEnded(String trackingID) {
  }

@Override
  public void onTripError(String reason) {
  }

}

(Note. This app requires location permission and gps enabled so cross check that your app has these functionalities and if location permission or gps is not enabled then location values won't be transmitted.)

SEND PUSH NOTIFICATION

We can also send push notification from driver side to customer just in case to update the current status of the driver.

Private void sendEventPush( ) {

   // userid - To whom your going to send a push.
  PushData pushData = new PushData("userId");

   //pushMessage - The message you would like to send.
  pushData.setMessage(pushMessage);

   // payload - you can send a String or even a JSONObject in this method.
  pushData.setPayload(payload);

  Teliver.sendEventPush("trackingId", pushData, "tag");

}

(Note: You can send push notification only after the trip started.)

STOP THE TRIP

You have to stop the trip when the driver reaches the customer location. Add this segment of code to stop the trip.

private void stopTrip() {

    Teliver.stopTrip("trackingId");

}

(Note:The trackingId is the same that you given during the start trip.)

ADDING TELIVER SDK TO YOUR CUSTOMER APP

This is same as we did with the driver side application. Step are similar to what we have done at driver side.

  • The Teliver library is hosted on Bintray and is available on JCenter.

  • Add the dependency right into your build.gradle file.

compile "com.teliver.sdk:TeliverSdk:1.0.8"

  • Sync the gradle project then add the necessary code to initialize TeliverSDK in your app.

GET THE GOOGLE MAPS API KEY

This step is to get the key from Google maps And paste the key in your manifest.xml get the key from the URL here.

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="API_KEY_FOR_MAP"/>

START TRACKING

Initiate the Teliver SDK by adding the following code in your Application class.

Teliver.init(this,""TELIVER_KEY"");

Once the customer is notified that the trip is started by driver, you can start tracking the driver by using the following piece of code.

Teliver.startTracking(new TripBuilder("trackingId").build());

you can start tracking the driver with listeners also, applied only when you build your own google map object.

private void startTrackingWithListeners( ) {

  TrackingBuilder builder = new TrackingBuilder(new MarkerOption(trackingId)).withYourMap(googleMap).withListener(new TrackingListener() {

  @Override
  public void onTrackingStarted(String trackingId) {

  }

  @Override
  public void onLocationUpdate(String trackingId, TLocation location) {

  }

  @Override
  public void onTrackingEnded(String trackingId) {

   }

  @Override
  public void onTrackingError(String reason) {

  }
 });

 Teliver.startTracking(builder.build());

}

(Note: The trackingId is the same trackingId that you used to start the trip on driver side, the trackingId is the spotting key to identify your driver.)

ENABLE PUSH NOTIFICATION

If you are using Firebase Cloud Messaging, simply follow this link to configure FCM with Teliver dashboard.

  • In your service class extending FirebaseMessagingService, you can identify whether the push is from Teliver or not by passing the remote message to isTeliverPush method.

 if (Teliver.isTeliverPush(remoteMessage)) {

  Map pushData = remoteMessage.getData( );

 NotificationData data = new GsonBuilder( )
 .create( ).fromJson(pushData.get("description"), NotificationData.class);
  }

(Note:The remote message contains the trackingId,message and command).

STOP TRACKING

To stop the ongoing tracking.

Teliver.stopTracking("trackingId");

(Note:The trackingId is the same that you given during the start trip.)

Live Tacking food deliveries are no more a myth. Don’t keep your customers waiting staring at the door for a knock or a bell! With Teliver integrated in your mobile app, Live tracking is now a reality. In this age of information, keeping a customer in dark could be the vilest thing a business could do.

Food Deliveries are fast adapting the technological advancements now present to fulfill this void. With nothing more than a working GPS enabled Smartphone with the delivery person would solve the issue when Teliver is incorporated in your mobile app. A life-time free plan is available for business starters who require no more than 120 delivery trips a month. Start T’elivering today!!!