Skip to content

Build Mobile App

Akram El Assas edited this page May 6, 2024 · 11 revisions

Prerequisites

To build Movin' In 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. Don't forget to set Firebase Server key in expo.dev > Credentials > Service Credentials > Google Cloud Messaging Token as stated in the documentation.

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

  • Go to expo.dev, Click on Pojects then Create a Project. Set Movin' In as project name and click on Create.

  • Go to Movin' In project and copy the project ID. Open ./mobile/app.json and paste the project ID in extra.eas.projectId.

  • Go to ./mobile folder and run the following command to login to expo:

npx expo login
  • Create an Expo Access Token from expo.dev (Account Settings > Access Tokens) and set api/.env MI_EXPO_ACCESS_TOKEN setting:
MI_EXPO_ACCESS_TOKEN=EXPO_ACCESS_TOKEN
  • Create mobile/.env file with the following content:
MI_API_HOST=https://movinin.io:4004
MI_DEFAULT_LANGUAGE=en
MI_PAGE_SIZE=20
MI_PROPERTIES_PAGE_SIZE=8
MI_BOOKINGS_PAGE_SIZE=8
MI_CDN_USERS=https://movinin.io/cdn/movinin/users
MI_CDN_PROPERTIES=https://movinin.io/cdn/movinin/properties
MI_AGENCY_IMAGE_WIDTH=60
MI_AGENCY_IMAGE_HEIGHT=30
MI_PROPERTY_IMAGE_WIDTH=300
MI_PROPERTY_IMAGE_HEIGHT=200
MI_MINIMUM_AGE=21
MI_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
MI_STRIPE_MERCHANT_IDENTIFIER=MERCHANT_IDENTIFIER
MI_STRIPE_COUNTRY_CODE=US
MI_STRIPE_CURRENCY_CODE=USD

Set the following options:

MI_API_HOST=https://movinin.io:4004
MI_CDN_USERS=https://movinin.io/cdn/movinin/users
MI_CDN_PROPERTIES=https://movinin.io/cdn/movinin/properties
MI_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
MI_STRIPE_MERCHANT_IDENTIFIER=MERCHANT_IDENTIFIER
MI_STRIPE_COUNTRY_CODE=US
MI_STRIPE_CURRENCY_CODE=USD

Replace https://movinin.io with an IP, hostname or FQDN.

If you want to enable stripe payment gateway, set stripe publishable key in MI_STRIPE_PUBLISHABLE_KEY. You can retrieve it from stripe dashboard.

MI_STRIPE_MERCHANT_IDENTIFIER is the merchant identifier you registered with Apple for use with Apple Pay.

MI_STRIPE_COUNTRY_CODE is the two-letter ISO 3166 code of the country of your business, e.g. "US". Required for Stripe payments.

MI_STRIPE_CURRENCY_CODE is the three-letter ISO 4217 alphabetic currency code, e.g. "USD" or "EUR". Required for Stripe payments. Must be a supported currency: https://docs.stripe.com/currencies

Production Build

If you want to use Movin' In mobile app on production, you should use HTTPS in Movin' In 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/movinin.git
  • Go to mobile folder:
cd ./mobile
  • Run the following command
npm install

Android

EAS Build

To build Movin' In Android app with EAS Build hosted service, run the following command:

npm run build:android

Local Build

macOS or Linux are required for local build. For Windows, you should use EAS Build.

You need to install Android Studio, openjdk-17, and set ANDROID_HOME and JAVA_HOME environment variables. Then, run the following command:

npm run build:android:local

On macOS, if you face some issues regrading local build, try to set ANDROID_HOME and JAVA_HOME environment variables in ./mobile/eas.json as follow:

{
  "cli": {
    "version": ">= 0.53.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "image": "latest",
        "gradleCommand": ":app:assembleDebug"
      },
      "ios": {
        "image": "latest",
        "buildConfiguration": "Debug"
      }
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {
      "env": {
        "ANDROID_HOME": "/path/to/android/sdk",
        "JAVA_HOME": "/path/to/java/home"
      },
      "android": {
        "image": "latest",
        "buildType": "apk"
      },
      "ios": {
        "image": "latest"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

iOS

You need a paid Apple Developer account to build the iOS app for both EAS builds and local builds.

EAS Build

To build Movin' In iOS app, run the following command:

npm run build:ios

Local Build

You need to install fastlane and CocoaPods on macOS.

To build Movin' In iOS app locally, run the following command:

npm run build:ios:local