Since you're using Expo and BLE requires native modules, here's exactly what you need to do:
Your app.json should include:
{
"expo": {
"name": "OfflinePay",
"plugins": [
[
"expo-dev-client",
{
"addGeneratedScheme": false
}
]
],
"ios": {
"infoPlist": {
"NSBluetoothAlwaysUsageDescription": "OfflinePay uses Bluetooth to discover nearby devices for offline transactions.",
"NSBluetoothPeripheralUsageDescription": "OfflinePay uses Bluetooth to connect with nearby devices for offline transactions."
}
},
"android": {
"permissions": [
"android.permission.BLUETOOTH",
"android.permission.BLUETOOTH_ADMIN",
"android.permission.BLUETOOTH_CONNECT",
"android.permission.BLUETOOTH_SCAN",
"android.permission.BLUETOOTH_ADVERTISE",
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION"
]
}
}
}# Install BLE library
npm install react-native-ble-plx
# Install development build client
npx expo install expo-dev-client
# Install EAS CLI for builds
npm install -g @expo/cli eas-cliCreate eas.json in project root:
{
"cli": {
"version": ">= 3.0.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"preview": {
"android": {
"buildType": "apk"
}
},
"production": {
"android": {
"buildType": "aab"
}
}
}
}# Login to Expo
eas login
# Build development APK
eas build --profile development --platform android
# Or build locally (faster)
npx expo run:androidIf EAS build is slow, build locally:
# Prebuild native code
npx expo prebuild
# Run on Android
npx expo run:android
# This creates an APK you can install and debugOnce you have the development build:
- Install the APK on your physical Android device
- Open the app → Navigate to "BLE Debug" screen
- Check Permission Status - should show all permissions as "granted"
- Start Scanning - should discover nearby BLE devices
- Export Logs if issues occur
# Clear cache and restart
npx expo start --clear# Rebuild from scratch
rm -rf node_modules
npm install
npx expo prebuild --clean
npx expo run:android- Manually grant permissions in Android Settings
- Use debug screen "Request Permissions" button
- Check Android version compatibility (needs Android 6+)
# 1. Build once
eas build --profile development --platform android
# 2. Install APK on device
# Download from EAS build or use adb install
# 3. Development workflow
npx expo start --dev-client
# 4. Code changes hot-reload automatically
# No need to rebuild APK for JS changes!When ready for production:
# Production AAB for Play Store
eas build --profile production --platform android
# Production APK for direct distribution
eas build --profile preview --platform androidBLE not working?
- ✅ Using development build (not Expo Go)
- ✅ Physical Android device (not emulator)
- ✅ Bluetooth enabled on device
- ✅ Location permissions granted
- ✅ Check BLE Debug screen for detailed status
Need faster development?
- Use
npx expo run:androidfor local builds - JS changes hot-reload without rebuilding APK
- Only rebuild when changing native dependencies
This setup will give you full BLE functionality with proper debugging capabilities! 🚀