Skip to content

Optimise Node Foreground Service #443

Description

@ovitrif

I observed some small issues with the current Node Foreground Service, namely:

  • The persistent OS notification doesn't initially show when starting on a fresh install with new wallet
    • User is not even aware of it, and can't close it, this is very unpredictable, even I as a developer of the app don't know for certain if the foreground service is alive or not, on a fresh install with a new wallet
  • Registering for LSP notifications happens before user the user approved background notifications
  • Severe battery drain from the service
    • It drains my Pixel 9 Pro battery in half day, compared to 1.5+ days without the app installed
  • Notifications for background receive are not showing up when the foreground service is running
    • From the LSP's PoV the node is alive, thus no cloud message gets dispatched to the device

We should plan for the critical performance optimisations and UI implementation to address the above issue, in order to ensure that the foreground service is seamlessly integrated with the existing functionalities within the app, mainly:

  • notifications permissions
  • background receive handler WakeNodeWorker
  • visible push notifications
  • battery saving optimisations

A solution idea might be to still manage the node lifecycle from the foreground service, but ONLY to ensure the node doesn't shutdown between fast app stops and restarts, but otherwise it still gets properly shut down in a timely manner instead of being kept alive to continue sync-ing with onchain every 10 seconds.

Subtasks

  • Show persistent notification only while permission is granted by the user
  • Register for LSP notifications after user grants permissions
  • Show the OS notifications for background receive also when foreground service is running
  • Optimise foreground service for battery saving

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions