In-App SDK Integration Guide
Learn how to integrate the In-App SDK into your native app, the mandatory and optional parameters you need to pass when calling the SDK and which starting points the SDK offers.
IOS
The format for the iOS In-App SDK is XCFramework. The BookingInApp.xcframework
is designed to help Affiliate partners integrate a comprehensive stays booking experience into their iOS apps. This guide will walk you through the steps required to implement the framework in your mobile project.
Prerequisites
- Xcode 12.0 or later
- Swift 5.0 or later
- An existing iOS project
IOS installation
Step 1: Download the framework
Download the BookingInApp.xcframework
package from the provided link.
Step 2: Add the framework to your project
- Open your iOS project in Xcode.
- Drag and drop the
BookingInApp.xcframework
into your project’s file navigator. - Ensure that, in the dialog that appears, the framework is added to the target of the app where you want to use the In-App SDK.
Step 3: Update build settings
- Go to your project’s target settings.
- Under the
General
tab, find theFrameworks, Libraries, and Embedded Content
section. - Ensure that
BookingInApp.xcframework
is listed and set toEmbed & Sign
.
Step 4: Add required permissions
- Go to your project’s target settings.
- Under the
Info
tab, find theCuston iOS Target Properties
section. - Add a new key to the list, with the name
Privacy - Location When In Use Usage Description
(NSLocationWhenInUseUsageDescription). And add a value with a text that the app needs access to the location to find accommodations around the current location.
Usage
Step 1: Import the framework
In the files where you want to use the SDK, import the framework:
import BookingInApp
Step 2: Load the Booking view
To present the booking view, you can use the following code snippet:
import SwiftUI
import BookingInApp
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink {
BookingInApp.showIndexPage(aid: "your-affiliate-id", label: "your-label")
} label: {
Text("Find a hotel")
}
}
}
}
The parameters to open the Booking view are:
Parameter | Type | Required | Description |
---|---|---|---|
aid | String | Required | The Affiliate ID that is provided to you by Booking.com for using the In-App SDK |
label | String | Required | The Affiliate label, which is used for tracking purposes |
lang | String | Optional | ISO 639-1 standard language code |
currencyCode | String | Optional | 3 Character ASCII code representing currency e.g. EUR, INR, USD, etc. |
loyaltyID | String | Optional | The Loyalty/membership ID of the user |
An example to perform a search with the optional parameters included:
BookingInApp.showIndexPage(
aid: "2284749",
label: "LabelForTracking",
lang: "es",
currencyCode: "EUR",
loyaltyID: "123456789")
Customisation
Show the search results
To display search results according to a search request:
BookingInApp.showSearchResultsPage(aid: "your-affiliate-id", label: "your-label", destination: "Amsterdam")
The parameters to perform a search are:
Parameter | Type | Required | Description |
---|---|---|---|
aid | String | Required | The Affiliate ID that is provided to you by Booking.com for using the In-App SDK |
label | String | Required | The Affiliate label, which is used for tracking purposes |
destination | String | Required | Destination name |
checkinDate | Date | Optional | Date for the checkin |
checkoutDate | Date | Optional | Date for the checkout |
numberOfAdults | Integer | Optional | Amount of adult guests |
numberOfRooms | Integer | Optional | Amount of rooms |
numberOfChildren | Integer | Optional | Amount of children |
agesChildren | Array of integers | Optional | For the ages of the children |
lang | String | Optional | ISO 639-1 standard language code |
currencyCode | String | Optional | 3 Character ASCII code representing currency e.g. EUR, INR, USD, etc. |
loyaltyID | String | Optional | The Loyalty/membership ID of the user |
An example to perform a search with the optional parameters included:
BookingInApp.showSearchResultsPage(
aid: "2284749",
label: "LabelForTracking",
destination: "Amsterdam",
checkinDate: Calendar.current.startOfDay(for: Date()),
checkoutDate: Calendar.current.date(byAdding: .day, value: 1, to: Calendar.current.startOfDay(for: Date())),
numberOfAdults: 2,
numberOfRooms: 1,
numberOfChildren: 2,
agesChildren: [5, 3],
lang: "es",
currencyCode: "EUR",
loyaltyID: "123456789")
Android installation
Prerequisites
- minSdk = 16
Step 1: Setup dependency
Since distribution at the MVP stage is done manually (not via Maven or Artifactory), the two dependencies below need to be included:
implementation(files("libs/inapplibrary-release.aar"))
implementation("com.google.androidbrowserhelper:androidbrowserhelper:2.5.0")
Step 2: Load Booking.com pages
Present index page
To present the index page, you can use the following code snippet:
import com.booking.inapplibrary.BookingInApp
BookingInApp.showIndexPage(
context = context,
aid = "your-affiliate-id",
label = "your-label",
lang = "en-us"
)
Show the search results
To open the Search Results directly based on a search query. This can be done as follows:
BookingInApp.showIndexPage(
context = context,
aid = "your-affiliate-id",
label = "your-label",
destination = "Amsterdam",
lang = "en-us"
)
The additional parameters to perform a search are:
Parameter | Type | Required | Description |
---|---|---|---|
checkinDate | Long | Optional | Date for the checkin |
checkoutDate | Long | Optional | Date for the checkout |
numberOfAdults | Integer | Optional | Amount of adult guests |
numberOfRooms | Integer | Optional | Amount of rooms |
numberOfChildren | Integer | Optional | Amount of children |
agesChildren | Array of integers | Optional | For the ages of the children |
lang | String | Optional | ISO 639-1 standard language code |
Support
Self-managed partners: use the contact form within the Booking.com Partner Center.
Managed partners: contact your account manager. Include as much information as possible when reporting a bug, including:
- Provide the Affiliate ID.
- Include the time and date of the issue.
- Include the entrypoint of the issue, either IndexPage or SearchResults.
- Include the impact of the issue.