Skip to content

Background notifications unreliable on Android #420

@AndreaDiazCorreia

Description

@AndreaDiazCorreia

Problem

Background notifications are inconsistent across Android devices. Some devices work
correctly, others don't receive notifications even with all permissions granted.

Root Causes

  1. Background service runs with low priority (isForegroundMode: false) - Android kills it
  2. FCM handler doesn't start the service when it's dead
  3. Missing Android permissions (WAKE_LOCK, battery optimization, boot completed)
  4. No subscription persistence - lost when service restarts
  5. No heartbeat/keep-alive for WebSocket connections

Proposed Solution

Hybrid approach:

  • No active trades: Background mode (no persistent notification), FCM can wake service
  • Active trades: Foreground service (protected, persistent notification)

Implementation Plan

  • Fix 03: Add Android permissions
  • Fix 02: FCM handler starts background service
  • Fix 04: Subscription persistence
  • Fix 01: Smart foreground service (only with active trades)

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions