Create a Transportation & Delivery Solution

1

Using PubNub, you can quickly and easily develop logistics and delivery solutions, such as

  • Package Delivery
  • Fleet Tracking
  • Taxi or Private Hire services
  • Food Delivery services

PubNub’s APIs and infrastructure allow you to provide real-time updates on vehicle location, driver performance, and customer satisfaction, enhancing the user experience and enabling a more efficient operation.

Track your vehicle fleet in real-time while at the same time allowing customers to see when their vehicle is on its way, where it is, and when it will arrive.

Delivery solutions vary significantly in scope and functionality but share standard requirements and architecture. This tutorial will describe the generic implementation and highlight any use-case-specific considerations where appropriate.

Tutorial - Delivery Application - Architecture

Your delivery solution will have some way of routing vehicles and displaying a route map to the end user. Google is a popular mapping/routing provider and is used in this tutorial, though other providers also exist. Once en route, all your delivery vehicles will need some way of providing updates in real-time on where they are and, optionally, their current status (e.g., stopped, moving, low fuel). How you gather vehicle location data will vary depending on your solution, it could be as simple as an app running on the delivery driver’s phone to “smart” trucks able to report full vehicle telemetry. Still, regardless of how you gather the data, PubNub will have an SDK to support your client.

Once you have collected your real-time vehicle data and published it to PubNub, PubNub will deliver that data to all interested parties. Take the vehicle location example; publishing the vehicle lat/long to PubNub can show the vehicle’s location on both the package recipient’s smartphone and the administrator’s dashboard back at HQ. You could also use PubNub functions to process messages in-flight, for example, to calculate vehicle ETA based on its current position or to moderate the language in chat messages.

The driver can also communicate with the user through PubNub, i.e., “Please leave my package with a neighbor” or “I am trying to deliver your food order and can’t find your house.”

This tutorial relies on our interactive delivery demo: https://www.pubnub.com/demos/delivery/ and will only consider vehicle location and basic interactivity between a driver and a customer. The aim is to show the general principles so you can develop your delivery solution along similar lines. As you use the demo, notice that it provides real-time location updates on delivery vehicles and allows communication with the driver.

The source code for the snippets used in this tutorial can be found on GitHub at https://github.com/PubNubDevelopers/delivery-demo

Prerequisites

Before following this tutorial, be sure you have the following installed:

This tutorial uses on our delivery demo/sample app. If you would like to follow along, please clone the GitHub repository:

git clone https://github.com/PubNubDevelopers/delivery-demo.git
BackStep 1 of 4Next