Overview
The BrokerOS mobile app is a native Android application built on Expo 54, React Native 0.81, and Expo Router 6. It includes custom native Kotlin modules for telephony automation and background audio handling. Because the app incorporates custom native code (theauto-dialer module), it cannot run inside the standard Expo Go client from Google Play. Developers and operators compile a custom development build using npx expo run:android or create standalone APK distributions using EAS (Expo Application Services).
Tooling & System Prerequisites
Before building or running the Android app, ensure your workstation meets the following requirements:Step 1: Install Dependencies
From the repository root, install monorepo dependencies. The custom nativeauto-dialer package is linked locally via "auto-dialer": "file:modules/auto-dialer":
npm install inside apps/mobile/modules/auto-dialer/ individually; pnpm manages the local workspace link automatically.
Step 2: Configure Environment Variables
Navigate toapps/mobile/ and initialize your local environment configuration:
apps/mobile/.env to configure your API endpoint and API keys:
Why localhost Does Not Work
Android devices and emulators operate within their own virtual network namespaces. Navigating to http://localhost:3000 from the phone attempts to connect to the phone itself, failing immediately. You must use:
- LAN IPv4 address (e.g.,
192.168.x.x:3000) when testing on physical handsets connected via Wi-Fi or USB tethering. 10.0.2.2:3000when testing on the standard Android Studio emulator.
- Windows (PowerShell):
ipconfig | findstr /i "ipv4" - macOS / Linux:
ifconfig | grep "inet " | grep -v 127.0.0.1
Step 3: Google Maps SDK Configuration
The mobile app relies on native Google Maps for GPS site visit verification, broker meeting logs, and sales executive tracking.- Open the Google Cloud Console.
- Select or create your project and navigate to APIs & Services -> Enabled APIs & Services.
- Enable the Maps SDK for Android.
- Go to Credentials, click Create Credentials -> API Key, and restrict the key to the Maps SDK for Android.
- Paste the key into
apps/mobile/.envunderEXPO_PUBLIC_GOOGLE_MAPS_API_KEY. - At compile time,
apps/mobile/app.config.tsinjects this key directly into the native Android Manifest.
Step 4: Firebase FCM Push Notifications Setup
Background push notifications require Firebase Cloud Messaging (FCM) linked to your Expo project:1
Create Project in Firebase Console
Open the Firebase Console and create a project for your brokerage.
2
Add Android Application
Click Add app -> Android. Enter the exact package name declared in
apps/mobile/app.json:3
Download google-services.json
Download (This file is gitignored for security. Reference
google-services.json and save it directly in the apps/mobile/ root folder:apps/mobile/google-services.json.example for structure).4
Generate Google Service Account Private Key
In Firebase, navigate to Project settings -> Service accounts. Click Generate new private key and download the resulting JSON credentials file.
5
Link Key to Expo Dashboard (FCM v1)
- Log in via your terminal:
npx expo login. - Open your Expo Dashboard in a browser.
- Navigate to your mobile project -> Credentials -> Android -> Push Credentials.
- Click Add FCM Server Key / Service Account Key and upload the JSON private key file downloaded from Firebase.
Step 5: Android Studio & Device Preparation
Option A: Running on the Android Emulator
- Launch Android Studio.
- Open the Virtual Device Manager (Device Manager).
- Create or start an Android Virtual Device (AVD) running Android 13 (API 33) or Android 14 (API 34) with Google APIs.
- Verify ADB sees the emulator:
Option B: Running on a Physical Android Handset
- Open Settings -> About phone on your Android device.
- Tap Build number 7 times to enable Developer options.
- Under Developer options, enable:
- USB debugging
- Install via USB
- Connect the phone to your computer via USB cable. When prompted on the phone, check Always allow from this computer and tap Allow.
- Verify in your terminal:
Step 6: Compiling and Launching the App
Windows Java Environment Setup
On Windows, if Gradle throws a Java or JDK compilation error, point your shell to Android Studioβs bundled Java runtime (JBR) before compiling:Run Native Android Compilation
From the monorepo root or theapps/mobile directory, launch the build:
- Generates the native Android project directory using prebuild plugins (including
plugins/withCmakeShortPath.js). - Compiles native C++ and Kotlin dependencies (React Native New Architecture and
auto-dialer). - Installs the resulting development client APK onto your connected device or emulator.
- Starts the Metro bundler server on port 8081.
Step 7: Storage Access Framework (SAF) Setup for Call Recording
For the auto-dialer to access audio recordings captured by ODialer or stock recording apps without requiring root privileges:- Install the approved call recording companion application (e.g., ODialer) on the Android device.
- In Android system settings, set ODialer as the default calling and recording app.
- Open the BrokerOS mobile app, sign in, and tap the settings icon in your workspace.
- Tap Recording Storage Folder.
- Android displays the system file picker via the Storage Access Framework (SAF). Navigate to the ODialer audio directory (usually
Internal Storage/ODialerorInternal Storage/Recordings/Call). - Tap Use this folder and confirm Allow.
- BrokerOS saves the persistent directory URI into Android
SharedPreferences. The native background worker (CallUploadWorker.kt) will now scan this folder automatically after every completed call.
Step 8: Running Maestro Native E2E Tests
BrokerOS mobile flows are verified using Maestro, an automated native UI testing framework. Test specifications live inapps/mobile/e2e/:
01-login-and-roles.yaml: Multi-role login and adaptive bottom navigation tabs.02-lead-autodialer.yaml: Lead queue loading, call initiation, and outcome logging.03-site-visit-verification.yaml: GPS coordinate acquisition and selfie check-in.04-inventory-unit-booking.yaml: Unit matrix filtering and booking creation.05-commissions.yaml: Sourcing manager broker commission settlements.
Install Maestro CLI
- Windows (PowerShell):
- macOS / Linux:
Execute Test Suite
With an active Android device or emulator connected (adb devices):
scripts/test-mobile-e2e.ts, boots the flows sequentially, and asserts that all role workspaces and native intents execute without regression.
Standalone APK Generation with EAS
To generate standalone APK packages for sideloading or internal distribution to field agents:.apk file that can be distributed directly to sales teams without requiring Android Studio on employee devices.