Skip to content

Build Mobile App

Akram El Assas edited this page Aug 2, 2023 · 41 revisions

Prerequisites

To build BookCars mobile app, you need to have the following tools installed on your machine:

Install eas-cli with the following command:

npm i -g eas-cli

Configuration

  • You need to download the google-services.json file and place it in ./mobile root directory for push notifications. Otherwise, the mobile app won't build.

  • If you don't have an Expo account, you'll need to create one to build BookCars mobile app.

  • Create an Expo Access Token from expo.dev (Account Settings > Access Tokens) and set api/.env BC_EXPO_ACCESS_TOKEN setting:

BC_EXPO_ACCESS_TOKEN=EXPO_ACCESS_TOKEN
  • Create mobile/.env file with the following options:
BC_API_HOST=https://bookcars.com:4002
BC_DEFAULT_LANGUAGE=en
BC_PAGE_SIZE=20
BC_CARS_PAGE_SIZE=8
BC_BOOKINGS_PAGE_SIZE=8
BC_CDN_USERS=https://bookcars.com/cdn/bookcars/users
BC_CDN_CARS=https://bookcars.com/cdn/bookcars/cars
BC_COMAPANY_IMAGE_WIDTH=60
BC_COMAPANY_IMAGE_HEIGHT=30
BC_CAR_IMAGE_WIDTH=300
BC_CAR_IMAGE_HEIGHT=200
BC_APP_TYPE=frontend
BC_MINIMUM_AGE=21

You must configure the following options:

BC_API_HOST
BC_CDN_USERS
BC_CDN_CARS

You need to replace bookcars.com with an IP address or a FQDN.

Production Build

If you want to use BookCars mobile app on production, you should use HTTPS in BookCars API and disable usesCleartextTraffic expo plugin in ./mobile/app.json by removing the line "./plugins/usesCleartextTraffic" in plugins section.

Instructions

  • Clone the source down to your machine:
git clone https://github.com/aelassas/bookcars.git
  • Go to mobile folder:
cd ./mobile

Android

Local Build

You need to install Android SDK, JDK 11, and set ANDROID_HOME and JAVA_HOME environment variables. Then, run the following command:

yarn build:android:local

EAS Build

To build BookCars Android app with EAS Build hosted service, use the following command and follow the instructions:

yarn build:android

iOS

To build BookCars iOS app, use the following command and follow the instructions:

yarn build:ios