Auto AIDER is a React Native mobile application that connects to vehicles via Bluetooth Low Energy (BLE) OBD2 adapters to read diagnostic trouble codes (DTCs) and provide real-time code interpretation powered by Google Gemini AI.
- React Native: 0.79.5
- Expo: 53.0.0 with Expo Router 5.1.2
- React: 19.0.0
- TypeScript: 5.8.3
- Navigation: React Navigation 7.x with Expo Router (file-based routing)
- Redux Toolkit: 2.8.2 with Redux Persist for offline state
- Android SDK: Level 35 (target), 24+ (minimum)
- Build System: Gradle 8.13, Kotlin 2.0.21, NDK 26.2.11394342
- JS Engine: JSC (Hermes disabled due to architecture compatibility)
- New Architecture: Currently disabled (newArchEnabled=false) - see Known Issues
- react-native-ble-plx: 3.5.0 - Core BLE communication library
- OBD2 Protocol: ISO 15765-2 Mode 03 (Read DTC)
- Supported Adapters: Any Bluetooth LE OBD2 adapter (ELM327 clones, VEEPEAK, etc.)
- Firebase: Authentication, Cloud Messaging, Analytics (v23.4.0)
- REST API: Custom backend for user data, shop management, diagnostic history
- Socket.io: Real-time updates for chat and notifications
- Google Gemini AI: Code interpretation and technical descriptions
- Axios: HTTP client for API calls
- dayjs: Date/time manipulation
- Lottie: JSON animation rendering
- Google Maps: Location services and shop discovery
- expo-dev-client: 5.2.4 (development only)
app/ # Main app source code (file-based routing)
├── _layout.tsx # Root layout with auth navigation
├── index.tsx # Entry point
├── auth/
│ ├── login.tsx
│ ├── signup.tsx
│ └── forgot-pass.tsx
├── car-owner/ # Car owner role screens
│ ├── _layout.tsx
│ ├── (screens)/ # Individual screens
│ ├── (tabs)/ # Bottom tab screens
│ └── run-diagnostics/ # BLE device discovery & DTC reading
├── repair-shop/ # Repair shop role screens
│ ├── _layout.tsx
│ ├── (screens)/
│ └── (tabs)/
├── chat-room/
└── error/
components/ # Reusable UI components
├── Header.tsx
├── TabBar.tsx
├── Loading.tsx
├── NetworkProvider.tsx # Network status context
├── PrivacyPolicyComp.tsx
├── TermsOfServiceComp.tsx
└── withNetworkCheck.tsx # HOC for offline functionality
hooks/ # Custom React hooks
├── useNetworkStatus.ts # Monitor online/offline
└── useBackRoute.ts # Handle back navigation
redux/ # Redux store and slices
├── store.ts
└── slices/
├── deviceSlice.ts # Connected OBD2 device state
├── scanSlice.ts # DTC scan results
├── vehicleDiagIDSlice.ts # Diagnostic history
└── [other slices]
services/ # API & external services
├── backendApi.ts # REST API calls
├── geminiApi.ts # Gemini AI integration
├── socket.ts # Socket.io client
├── notifications.ts # Push notification handlers
├── interceptor.ts # Axios interceptor for auth
└── tokenStorage.ts # Secure token management
types/ # TypeScript type definitions
├── user.ts
├── vehicle.ts
├── vehicleDiagnostic.ts
├── mechanicRequest.ts
└── autoRepairShop.ts
config/ # Configuration files
docs/ # Documentation
assets/ # Images, fonts, sounds, animations
android/ # Native Android code
├── app/
│ ├── src/main/AndroidManifest.xml # Permissions & activities
│ └── src/main/res/values/styles.xml # Themes
└── gradle.properties # Build configuration
- File:
app/car-owner/(screens)/run-diagnostics/run-diagnostics.tsx - Scans for Bluetooth LE OBD2 adapters
- Supports device names: OBD, ELM, VEEPEAK, and derivatives
- Establishes BLE connection and discovers service characteristics
- Initializes adapter with AT commands (ATZ, ATE0, ATS0, ATH0)
- Protocol: OBD2 Mode 03 (Read DTC)
- Commands:
03- Standard DTC read command0300- Fallback format for compatibility
- Timeout: 10 seconds (fallback 8 seconds)
- Response: Hex-encoded codes with format PXYZZ (P=category, X=system, Y=problem, Z=condition)
- AI Service: Google Gemini API
- For Each Code: Returns technical description, meaning, common causes, typical repairs
- User Display: Card-based UI showing code details and repair suggestions
- Manifest Declaration: Added
usesPermissionFlags="neverForLocation"to prevent location-based permission routing - Permission Flow:
- Request BLUETOOTH_SCAN (Bluetooth discovery)
- Request BLUETOOTH_CONNECT (Bluetooth connection)
- Request ACCESS_FINE_LOCATION (for reliable permission grant)
- Sequential Request: Permissions requested one-by-one, not batched
# Install dependencies
npm install
# Start development server
npx expo start
# Connect device or emulator and press 'a' for Android# Build unsigned release APK
cd android
./gradlew assembleRelease
cd ..
# APK location: android/app/build/outputs/apk/release/app-release-unsigned.apk
# OR use Expo to build signed APK
eas build --platform android --profile release- metro.config.js: Metro bundler config (CommonJS format, SVG transformer enabled)
- eslint.config.js: ESLint v9 flat config format
- tsconfig.json: TypeScript configuration with strict mode
- app.config.js: Expo app configuration (plugins, permissions, etc.)
Required Permissions:
BLUETOOTH_SCAN- Discover OBD2 adaptersBLUETOOTH_CONNECT- Connect to discovered devicesACCESS_FINE_LOCATION- Location access (required for Bluetooth on some Android versions)INTERNET- Backend API communicationMODIFY_AUDIO_SETTINGS- Audio-related featuresRECORD_AUDIO- Audio recording if applicable
Optional Permissions:
ACCESS_BACKGROUND_LOCATION- Background location (currently not used)SCHEDULE_EXACT_ALARM- Precise alarms
- deviceSlice: Connected OBD2 device info (name, UUID, characteristic UUIDs)
- scanSlice: Latest DTC scan results and status
- vehicleDiagIDSlice: Historical diagnostic records
- vehicleDiagIDArrSlice: Array of diagnostic sessions
- senderReceiverSlice: Chat message participants
- tabBarSlice: Active tab state
- roleSlice: User role (car-owner, repair-shop)
1. discoverDevices()
└─ Scan for BLE devices (20s timeout, filter by name)
2. connectToDevice(device)
└─ Establish BLE connection
└─ Discover services & characteristics
└─ Initialize with AT commands
3. readCodes()
└─ sendCommand('03', 10s)
└─ If no response: sendCommand('0300', 8s)
4. parseDTCResponse(raw)
└─ Validate response format ('43' header)
└─ Extract count byte
└─ Parse hex DTC values
└─ Return array of decoded codes
5. decodeDTC(hex)
└─ Convert 4-char hex to PXYZZ format
└─ Return standardized DTC code
6. handleCodeInterpretation(codes[])
└─ Send each code to Gemini API
└─ Display interpretation to user
- Status:
newArchEnabled=falseinandroid/gradle.properties - Reason: expo-dev-menu-interface v1.8.4 incompatible with React Native 0.79.5 bridgeless architecture
- Error: Kotlin compilation fails with unresolved references to ReactFeatureFlags properties
- Impact: Performance optimization not available; app works on JSC engine
- Solution: Upgrade to newer Expo or downgrade React Native (pending investigation)
- Status: Sometimes returns "No codes detected" on vehicles with active check engine light
- Possible Causes:
- Different OBD2 adapter dialect/protocol variant
- Insufficient adapter initialization sequence
- Timing issues specific to release builds
- Adapter not returning data in expected format
- Debug Steps:
- Build and install release APK
- Connect real vehicle with OBD2 adapter
- Run:
adb logcat | Select-String "ReactNativeJS"(Windows PowerShell) - Tap "Discover Devices" and "Scan"
- Check console output for raw adapter response
- Share logs showing exact response format
- Workaround: Comprehensive logging added to
parseDTCResponse()for debugging
- Status: JSC only (hermesEnabled=false)
- Reason: Hermes incompatible with new architecture disabled state in build system
- Impact: Slightly larger app size, slower startup
- Solution: Re-enable once new architecture stabilized
Add this to terminal to monitor all BLE operations:
adb logcat | Select-String "ReactNativeJS" | Select-String "BLE|DTC|Command|Parse"=== Starting device discovery ===- Scan started=== Found device: [name] ===- Device discoveredSending command: [cmd]- OBD2 command sentResponse received: [hex]- Raw adapter responseRaw response: "[data]"- Before parsingAfter cleanup: "[data]"- Whitespace removedExtracted DTCs: [codes]- Successfully parsed codesERROR: Failed to parse response- Parsing failed
- BLE Polling: 100ms lock, 200ms response (reduced from 20/50ms for release stability)
- Command Timeout: 5s default, 10s for DTC read (increased for adapter latency)
- Redux Persist: Offline state preservation
- Network Monitoring: Graceful degradation when offline
- Image Optimization: Lottie animations for smooth performance
- Install Node.js: v18+ required
- Install Android Studio: For SDK, emulator, build tools
- Clone & Install:
npm install
- Configure Environment:
- Create
.envwith backend API URL - Add Firebase configuration
- Configure Gemini API key
- Create
- Run Development:
npx expo start
- Test on Device:
- Install Expo Go or development build
- Scan QR code from terminal
- Test Bluetooth permissions on Android 12+
- Follow TypeScript strict mode
- Add console.log statements for debugging (removed in production builds)
- Test on real Android device before merging
- Update Redux slices for state changes
- Add types for all API responses
- Ensure
android:usesPermissionFlags="neverForLocation"in AndroidManifest.xml - Clear app cache:
adb shell pm clear [package.name] - Test on Android 12+ device
- Ensure adapter is powered on and in pairing mode
- Check adapter battery
- Verify vehicle is on (some adapters require vehicle power)
- Confirm adapter Bluetooth name matches filter (OBD, ELM, VEEPEAK)
- Check logcat for exceptions in
parseDTCResponse() - Verify adapter responds with expected format
- Check timeout values (may need increase for slower adapters)
# Clean build artifacts
cd android
./gradlew clean
cd ..
# Rebuild
cd android
./gradlew assembleRelease- Firebase Console: Monitor authentication, analytics, messaging
- Google Gemini API: Documentation at ai.google.dev
- OBD2 Protocol: ISO 15765-2 specification
- React Native BLE: https://github.com/dotintent/react-native-ble-plx