androidx / androidx/media

Android 17 AudioFocus

Open
#1,815 20 comments 6 reactions 1 assignee View on GitHub

@tonihei is already working on this.

Since Oct 18, 2024.

question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

I completely missed a change in Android 15 about audio focus : https://developer.android.com/about/versions/15/behavior-changes-15#audio-focus

With a link to the doc page https://developer.android.com/media/optimize/audio-focus that absolutely does not cover this new major restriction.

We can no more request focus if the app is not in foreground and of course we can no more go to foreground from the background.

This breaks features like auto play on headset plug, auto play on bt connection, any kind of automations via a published API and a few other cases.

Is there some things planned around that or documentation or are we really supposed to ask the user to exclude the app from battery restriction and by doing so generate the complete opposite of what all those limitations are supposed to do?

Media3 already catch the many ways the startForeground can be refused, so is there something planned to ensure we can request the focus and play music or we are all out of luck?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.