BLE functionality WILL NOT WORK in Expo Go or managed workflow. You must use:
- Expo Development Build (recommended)
- Bare React Native workflow
- Physical device testing (BLE doesn't work in emulators)
# Install Expo CLI and development build tools
npm install -g @expo/cli eas-cli
# Create development build
eas build --profile development --platform android
# Or build locally (faster for debugging)
npx expo run:android# Eject to bare workflow
npx expo eject
# Build and run
npx react-native run-android- Navigate to "BLE Debug" in your app
- Real-time permission status
- Live BLE logs with filtering
- Device discovery monitoring
- Export logs for analysis
# Filter for BLE logs
adb logcat | grep -i "ble\|bluetooth"
# OfflinePay specific logs
adb logcat | grep -E "(ble-relay|BLE-)"
# All app logs
adb logcat | grep "com.anonymous.wallet"# Install and run
npm install -g react-native-debugger
react-native-debugger- Shake device → "Debug JS Remotely"
- Open Chrome →
http://localhost:8081/debugger-ui/ - Check console for detailed BLE logs
BLE not supported - react-native-ble-plx unavailable
Solution:
- Ensure you're using development build or bare workflow
- Check
react-native-ble-plxis installed:npm list react-native-ble-plx
- Rebuild the app after installing BLE dependencies
BLE permissions not granted
Solution:
- Open Debug Screen → Check permission status
- Manually grant permissions in Android Settings
- Use "Request Permissions" button in debug screen
Scan failed: Bluetooth is not enabled
Solution:
- Enable Bluetooth in device settings
- Check Debug Screen for adapter state
- Try stopping/starting scan from debug screen
Check:
- Both devices have BLE enabled
- Both devices are running the app
- Devices are within BLE range (<10m)
- Check logs for permission/scanning issues
- Using development build or bare workflow
- Testing on physical device (not emulator)
- Bluetooth enabled on device
- Location services enabled (Android requirement)
- App has all required permissions
- Open BLE Debug Screen
- Check permission status (all should be "granted")
- Verify BLE service is "Supported" and "Initialized"
- Start scanning and check for discovered devices
- Monitor logs for errors or warnings
- Permission status from debug screen
- BLE adapter state
- Error messages from logs
- Device discovery results
- Platform/Android version info
If automatic permission requests fail:
- Settings → Apps → OfflinePay → Permissions
- Enable:
- Location (required for BLE scanning)
- Nearby devices (Android 12+)
- Phone (may be required for some BLE operations)
- Settings → Developer Options
- Enable "Bluetooth HCI snoop log" for advanced debugging
- Logs saved to:
/sdcard/Android/data/btsnoop_hci.log
[BLE-RELAY]- Main service logs[BLE-PERMISSIONS]- Permission handling[BLE-STATE]- Adapter state changes[BLE-DISCOVERY]- Device discovery[BLE-CONNECTION]- Connection attempts[BLE-HANDSHAKE]- Security handshake[BLE-PAYLOAD]- Transaction transmission
- 🔍 DEBUG - Detailed operation info
- ℹ️ INFO - General status updates
⚠️ WARN - Potential issues- ❌ ERROR - Critical failures
- Verify BLE initialization
- Check permission status
- Test advertising/scanning toggle
- Device A: Start advertising
- Device B: Start scanning
- Verify Device B discovers Device A
- Check signal strength (RSSI)
- Device A: Online relayer mode
- Device B: Send transaction via BLE
- Monitor handshake and payload transmission
- Verify acknowledgments received
- BLE scanning can drain battery
- Use intermittent scanning in production
- Stop scanning when app backgrounded
- Keep devices within 5-10 meters
- Avoid interference from WiFi/other BLE devices
- Use retry mechanisms for failed connections
When reporting BLE issues, include:
- Device Info: Android version, device model
- Build Info: Development build or bare workflow
- Permission Status: Screenshot from debug screen
- Logs: Exported logs from debug screen
- Steps to Reproduce: Exact sequence that causes issue
# Enable HCI logging
adb shell settings put secure bluetooth_hci_log 1
# Restart Bluetooth
adb shell am broadcast -a android.bluetooth.adapter.action.REQUEST_DISABLE
adb shell am broadcast -a android.bluetooth.adapter.action.REQUEST_ENABLE
# Pull logs
adb pull /sdcard/Android/data/btsnoop_hci.log- Install Wireshark with Bluetooth support
- Open
btsnoop_hci.logfile - Filter for BLE packets:
btle - Analyze connection, advertising, and data packets
Remember: BLE debugging requires patience and physical devices! 🔧📱