How to Create a Real-Time Delivery Application
There are several types of delivery application:
- Parcel Delivery
- Fleet Tracking
- Taxi or Private Hire services (like Uber)
- Food Delivery services (like Uber eats or Postmates)
Developing any on-demand delivery solution comes with challenges, with external dependencies on server APIs and client operating systems. Regardless of how your delivery application works under the covers, the end user experience (& satisfaction) will depend on providing real-time updates on vehicle location, delivery time, and delivery status.
The Common Pieces of Any Delivery Application
Whether your application is delivering packages, food, or taxi services, you will have a standard set of components:
- A user client. Most of us are familiar with rideshare or food delivery applications where the client is an application running on your mobile phone allowing you to request a driver and see their status as they come to you. You can also think of a client as an admin dashboard for the system administrator view. An admin dashboard displays all deliveries or trips, their status, and other information like vehicle telemetry or user sentiment in real-time.
- A mapping provider. You will need a way to show the location of vehicles to your users, and a map is the most obvious way to achieve this. The mapping provider is probably an external service such as Google maps that offers additional features such as overlays, location markers, and interactivity.
- A routing provider. Your routing provider is probably an external service that provides route optimization and returns a ‘route’ between two points expressed as a list of latitude/longitude points or turn-by-turn directions. More complex routing providers will consider external factors, such as road closures and traffic conditions, so you might need to update your vehicle routes in real-time.
- Vehicles. Vehicles, at a minimum, need to report their current location in real-time so they can show on the client map and potentially be re-routed based on prevailing traffic conditions. The speed at which the location is retrieved directly impacts the end-user experience because it drives the update rate of the vehicle on the map. Vehicle updates are not limited to location; you might provide insights into driver performance, vehicle telemetry (stopped, moving, low fuel), or alerts such as crash reporting.
- Backend Infrastructure. None of these pieces can exist in isolation, and you will need a backend server for your application logic. For example, you provide a daily route to delivery drivers, onboarding a new private taxi driver, or interfacing with the restaurants supported by your food delivery app. Most of your solution will rely on real-time data exchanged between clients and vehicles, providing notifications or push notifications to the user.
Determining Vehicle Location
Any delivery tracking solution must determine the vehicle location, and the rate at which you can update the location will affect the end-user experience. How you determine location depends on your delivery use case:
- Food delivery software relies on drivers using smartphones, potentially using their personal phones, and running a mobile app (driver app) you have developed. This app is explicitly designed for those drivers and downloaded from the Android or iOS app store. Determining the location of a smartphone is straightforward since all mobile application platforms offer dedicated location APIs.
- Private hire and taxi drivers (like Uber) are similar to food delivery drivers in that they often use a smartphone, either their personal device or a device provided by their employer, to run a tracking app that provides route information to the driver and gives the customer information about the vehicle.
- Logistics companies and courier services will often provide their delivery drivers with dedicated industrial devices, but since these devices frequently run Android, you can again use the location APIs provided by the platform to show the last mile of delivery.
In general, powered devices that have your delivery application running in the foreground will be able to retrieve location updates the fastest.
Determining Vehicle Estimated Time of Arrival
The vehicle's estimated time of arrival (ETA) is non-trivial to calculate and will depend on prevailing traffic conditions, time of day, weather, etc. Many routing providers provide API mapping that calculates the ETA between your vehicle’s current location and its destination; this could be invoked intermittently during location updates in real-time to provide the end user with a clearer picture of when the vehicle will arrive.
PubNub can add Real-Time Communication to your Delivery app
A significant part of your solution will rely on real-time data exchanged between clients and vehicles; this is where PubNub can help. Creating a communication solution that can scale to any number of vehicles and clients, all exchanging data is non-trivial. PubNub has a proven track record with many delivery business models.
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.
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.
The driver can also communicate with the user through PubNub, i.e., “Please leave my package with a neighbor” or “Order tracking update: I just updated your food order status.”
Delivery solutions that provide proof of delivery are complex, and one thing they all have in common is real-time connectivity. The feedback we consistently receive from our delivery business customers is that PubNub improves their end-user experience by enabling them to provide more real-time updates.
PubNub Tutorial and Demo
Check out the PubNub delivery tutorial and demo that illustrates the minimum viable product (MVP) of a generic tracking system for a fictitious delivery company that provides courier delivery. The tutorial is aimed at startups or small businesses that provide eCommerce solutions such as on-demand delivery apps or manage delivery operations.