Table of Contents

  1. Start Booking
  2. Deep linking data
  3. Further reading

1. Start Booking

Start the booking flow by doing:

Mozio.startBooking(this)
Mozio.getInstance().startBooking(MainActivity.this);


We will use the user’s GPS position as the start location, the user will be prompted to enter the destination as seen next:

2. Deep linking data

2.1 Deep linking passenger data and currency

In the booking flow, the user will be required to enter the passenger information. If you already know this data you can deep link it to us and we’ll pre-fill those fields.

You can also specify the currency to be used for all prices by using the ISO 4217 currency code.

// 1. Set user data and currency:
val passengerData = MozioPassengerData(
    "John", // First Name
    "Doe", // Last Name
    "jd@example.com", // Email
    "US", // Phone country code
    "786123456", // Phone number
    "MXN" // Currency. This example uses Mexican Peso
)

// 2. Start the booking flow:
val bookingData = MozioBookingData.Builder()
    .passengerData(passengerData)
    .build()
Mozio.startBooking(this, bookingData)
// 1. Set user data and currency:
MozioPassengerData passengerData = new MozioPassengerData(
    "John", // First Name
    "Doe", // Last Name
    "jd@example.com", // Email
    "US", // Phone country code
    "786123456", // Phone number
    "MXN" // Currency. This example uses Mexican Peso
);

// 2. Start the booking flow:
MozioBookingData bookingData = new MozioBookingData.Builder()
    .passengerData(passengerData)
    .build();
Mozio.getInstance().startBooking(MainActivity.this, bookingData);


Now the confirmation screen will be prefilled:

Showing results in a deep linked currency:

When you don’t specify a currency, all prices are displayed in USD.

2.2 Deep linking search data

In the booking flow, user will be required to enter the following data about the ride:

  • Start location
  • End location
  • Pickup time
  • Return pickup time (for roundtrips)

If you already know this data, you can deep link it to us and we’ll pre-fill those fields.

For example, let’s say that the user just purchased a flight ticket that departs from San Francisco Airport and you want to offer to book a ride there. This is how you’d deep link that search:

// 1. The start location will be the user's GPS location:
val start = MozioSearchLocation.GPS

// 2. The end location is the San Francisco Airport:
val end = MozioSearchLocation.Place(
    37.620710, // Latitude, required
    -122.379867, // Longitude, required
    "ChIJVVVVVYx3j4ARyN7qnq2JceQ", // Google Place ID, optional
    "San Francisco Airport" // Address, optional
)

// 3. Set the pickup time
// 3.1 For prebooking one-way rides:
val pickupTime = MozioSearchPickupTime.SpecificDate(LocalDateTime.of(2019, 5, 22, 17, 45, 0))
//
// OR
//
// 3.2 For prebooking a round trip:
// Note: make sure the return pickup time is after the provided outbound pickup time.
// If an invalid return pickup time is provided, it will be ignored.
val pickupTime = MozioSearchPickupTime.RoundTrip(
  // Outbound:
  LocalDateTime.of(2019/*year*/, 5/*month*/, 22/*day*/, 17/*hour*/, 45/*minutes*/),
  // Return:
  LocalDateTime.of(2019/*year*/, 6/*month*/, 27/*day*/, 8/*hour*/, 30/*minutes*/)
)
//
// OR
//
// 3.3 For booking ondemand rides (that's the default):
val pickupTime = MozioSearchPickupTime.LeaveNow

// 4. Set the search data:
val mySearchData = MozioSearchData(start, end, pickupTime)
val myBookingData = MozioBookingData.Builder()
    .searchData(mySearchData)
    .build()

// 5. Start the booking flow:
Mozio.startBooking(this, bookingData = myBookingData)
// 1. The start location will be the user's GPS location:
Location start = MozioSearchLocation.GPS();

// 2. The end location is the San Francisco Airport:
Location end = new MozioSearchLocation.Place(
    37.620710, // Latitude, required
    -122.379867, // Longitude, required
    "ChIJVVVVVYx3j4ARyN7qnq2JceQ", // Google Place ID, optional
    "San Francisco Airport" // Address, optional
);

// 3. Set the pickup time
// 3.1 For prebooking rides:
MozioSearchPickupTime pickupTime = new MozioSearchPickupTime.SpecificDate(
  LocalDateTime.of(2019/*year*/, 12/*month*/, 25/*day*/, 20/*hour*/, 0/*minutes*/)
);
// 
// OR
//
// 3.2 For prebooking a round trip:
// Note: make sure the return pickup time is after the provided outbound pickup time.
// If an invalid return pickup time is provided, it will be ignored.
MozioSearchPickupTime pickupTime = new MozioSearchPickupTime.RoundTrip(
    // Outbound:
    LocalDateTime.of(2019/*year*/, 12/*month*/, 25/*day*/, 20/*hour*/, 0/*minutes*/),
    // Return:
    LocalDateTime.of(2019/*year*/, 1/*month*/, 27/*day*/, 10/*hour*/, 30/*minutes*/)
);
//
// OR
//
// 3.3 For booking ondemand rides (that's the default):
MozioSearchPickupTime pickupTime = MozioSearchPickupTime.LeaveNow();

// 4. Create the booking data:
MozioSearchData searchData = new MozioSearchData(start, end, pickupTime);
MozioBookingData bookingData = new MozioBookingData.Builder()
    .searchData(searchData)
    .build();

// 5. Start the booking flow:
Mozio.getInstance().startBooking(MainActivity.this, bookingData);


User will be taken directly to search results as seen next:

You will notice that the googleId and address fields are optional and you can pass null to them. We recommend providing this data if you already have it to get more accurate results.

The googleId field corresponds to Google’s unique identifier for places (PlaceID), you can read more about it here.

2.3 Deep linking payment data

Your app will probably keep payment information about the users (credit and debit cards). If desired, this information can be deep linked to Mozio so that users can use the same cards for the booking of rides. The explanation of such feature can be found at our Deep linking payment data guide.

2.4 Deep linking extra data

You can specify extra data to be linked with the reservation as follows:

val bookingExtraData = MozioBookingExtraData(
    campaign = "android_sdk",
    branch = "confirmation_email",
    partnerTrackingId = "f486b746-7da0-11e9-8f9e-2a86e4085a59"
)

val bookingData = MozioBookingData.Builder()
    .bookingExtraData(bookingExtraData)
    .build();

Mozio.startBooking(this, bookingData = bookingData)
MozioBookingExtraData bookingExtraData = new MozioBookingExtraData(
    "android_sdk", // Campaign
    "confirmation_email", // Branch
    "f486b746-7da0-11e9-8f9e-2a86e4085a59" // Partner tracking ID
);

MozioBookingData bookingData = new MozioBookingData.Builder()
    .bookingExtraData(bookingExtraData)
    .build();

Mozio.getInstance().startBooking(MainActivity.this, bookingData);


Passed data through this method will be available in the reports sent each month via email.

3. Further reading

There are other topics you will need to cover, like adding Tracking status to your UI and using the Staging environment to test the booking flow.
Full details in our Advanced guide.