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

Background playback and notification #4482

Closed
ControlAdad opened this issue Jul 8, 2018 · 2 comments
Closed

Background playback and notification #4482

ControlAdad opened this issue Jul 8, 2018 · 2 comments
Assignees
Labels

Comments

@ControlAdad
Copy link

@ControlAdad ControlAdad commented Jul 8, 2018

  1. To keep audio playback alive in background, I need to start a foreground service or just displaying PlayerNotificationManager notification is enough and it puts my service in whitelist (see this for whitelist definition https://developer.android.com/about/versions/oreo/background)?
  2. If I should start a foreground service, startForeground(id,notification) method needs a Notification. I am using PlayerNotificationManager.createWithNotificationChannel to add a notification to player, but I can't use this notification in startForeground (it's not public). Shall I display 2 notifications?!
@ojw28

This comment has been minimized.

Copy link
Contributor

@ojw28 ojw28 commented Jul 23, 2018

  1. You do need a foreground service. The notification alone is not sufficient.
  2. PlayerNotificationManager has callbacks that it invokes when it starts and stops showing a notification. You can use these to put your service into (and out of) the foreground. There's an example of this here.
@ojw28 ojw28 closed this Jul 23, 2018
@ojw28

This comment has been minimized.

Copy link
Contributor

@ojw28 ojw28 commented Jul 23, 2018

You may also find this talk helpful, which walks through much of the example I've linked to in my post above.

@google google locked and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.