Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/android background audio source #54

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

tonelli-m
Copy link
Collaborator

Description

Bind the audio source to a Foreground Service to keep it running when the app is in the background.

Changes

  • Added an AudioSourceService class for Android that will take care of handling the audio thread as a foreground service
  • A persistent notification will be shown in the notification center while the service is running
    • Notifications permission needs to be granted to show notifications for android 13 (tiramisu) and above. The service can still run if the user denies permission, only the notification will not show.
    • For Android 14 (Upside down cake) and above, the persistent notification can still manually be dismissed, it will not stick. However dismissing the notification doesn't stop the service either, it simply removes it from the drawer. More details

Linked issues

#49
#38

Remaining TODOs

  • This is just a basic implementation of a foreground service, it may need to be tweaked to reduce even more the chances of the service being killed by the system. Further testing on a broader range of devices would be needed for this.
  • ATM the service is start as soon as the measurements screen is open and is directly tied to the audio source. Later, we might want to keep both separate to only start the service when a recording has been explicitly started by the user. This will be the scope of another PR though as all the elements are not yet present for a more complex implementation.
  • We may want to add some controls and additional information to the notification in the future like duration of the measurement, pause/resume/stop buttons, etc.

Checklist

  • Code compiles correctly on all platforms
  • All pre-existing tests are passing
  • If needed, new tests have been added
  • Extended the README / documentation if necessary
  • Added code has been documented

@tonelli-m tonelli-m added the Android Android related code label Nov 28, 2024
@nicolas-f nicolas-f merged commit 5d347e3 into version/0.2.0 Dec 2, 2024
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android related code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants