4

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.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Stefan Zhelyazkov
  • 2,599
  • 4
  • 16
  • 41
  • I found my own solution to avoid this. But it requires to NOT use mediaRouter.select(route_you_need). Instead I use castContext.startSession(intent). If you want, I can write here more. – Yevhen Vasilenko Dec 23 '20 at 20:54

0 Answers0