CrewTalk
Available 5 min read

Auto-Reconnect and Reliability

CrewTalk is built for professional use where reliability is critical. The app uses multiple strategies to maintain your connection and recover quickly from network disruptions.

Auto-Reconnect

When your connection drops (network switch, momentary outage, server restart), CrewTalk automatically reconnects using exponential backoff:

Attempt Delay
1 2 seconds
2 4 seconds
3 8 seconds
4 15 seconds
5–20 30 seconds

The app makes up to 20 reconnection attempts before giving up. If all attempts fail, bringing the app to the foreground triggers a fresh connection attempt.

📝 Note

Both the audio relay (TCP) and message relay (WebSocket) have independent reconnection logic. One can reconnect while the other is still trying, so you might receive messages even if audio is temporarily down.

Token Refresh

Firebase authentication tokens expire after 1 hour. CrewTalk handles this proactively:

  • Periodic refresh — Tokens are refreshed every 45 minutes in the background
  • Pre-reconnect refresh — Before any reconnection attempt, a fresh token is obtained
  • Foreground refresh — When the app returns to the foreground, the token is checked and refreshed if needed

This prevents the scenario where your connection drops due to an expired token.

Foreground Service (Android)

On Android, CrewTalk runs a foreground service that keeps the audio connection alive when the app is in the background:

  • Shows a persistent notification: "CrewTalk — Connected to [hub name]"
  • Uses FOREGROUND_SERVICE_TYPE_MICROPHONE for PTT capability
  • Acquires a wake lock to prevent the CPU from sleeping
  • The service starts when you enter a hub and stops when you leave

Battery Optimization

CrewTalk requests exemption from Android's battery optimization to prevent the system from killing the background connection. When prompted:

  1. Tap Allow to exempt CrewTalk from battery restrictions
  2. This ensures the audio relay stays connected during long shoots
  3. The actual battery impact is minimal — the app only uses significant power when actively transmitting
⚠️ Battery Optimization

If you denied the battery optimization prompt, you can enable it manually: Settings > Apps > CrewTalk > Battery > Unrestricted. Without this, Android may disconnect CrewTalk after a period of background use.

iOS Background Modes

On iOS, CrewTalk uses background audio and VoIP modes to maintain the connection. iOS is more restrictive about background execution, but the audio session keeps the app alive while you're connected to a hub.

Connection Recovery Flow

When your app returns to the foreground after being backgrounded:

  1. AppState listener detects the active transition
  2. Token is refreshed to ensure validity
  3. WebSocket status is checked — reconnects if disconnected
  4. Audio relay status is checked — reconnects if disconnected
  5. Presence is updated to "online"

This entire flow happens in under 2 seconds on a good network connection.

Tips for Maximum Reliability

  • Grant battery optimization exemption on Android
  • Keep the app in the foreground when actively on set
  • Use a stable network — wired or strong Wi-Fi beats congested cellular
  • Monitor connection quality — the status row indicator warns you before audio breaks up
  • Trust the auto-reconnect — manual disconnect/reconnect is rarely needed

Frequently Asked Questions

CrewTalk automatically attempts to reconnect using exponential backoff. Starting at 2 seconds, it retries at increasing intervals (4s, 8s, 15s, 30s) for up to 20 attempts. When your connection returns, audio resumes automatically.
On Android, yes — the foreground service keeps the connection alive. On iOS, background audio modes maintain the connection, though iOS may eventually suspend the app after extended background use.
Firebase auth tokens expire after 1 hour. CrewTalk proactively refreshes tokens every 45 minutes and always refreshes before reconnecting to ensure your session stays valid.