I am using SessionManager to manage a Cast session to a Chromecast device. In my Activity onPause()
I have the following code:
val sessionManager = castContext.sessionManager
sessionManager.removeSessionManagerListener(castSessionManagerListener, CastSession::class.java)
sessionManager.endCurrentSession(false)
I found out that the receiver applications stops. I checked the documentation and it says:
public void endCurrentSession (boolean stopCasting)
Ends the current session.
stopCasting Should the receiver application be stopped when ending the current Session.
Even though I use false
it still stops the receiver application. Why? I want the receiver application to keep streaming even if my application is in background or closed completely. For example, the YouTube app works that way.