According to
https://developers.google.com/cast/docs/design_checklist#sender-control-end
Sender stops cast
Content which is cast to a TV continues playing until either the last
connected sender disconnects, or until a sender casts something new.
Required
A When the last or only sender is connected to a receiver, tapping
Disconnect stops the app running on the receiver, and either
continues playing or pauses on the sender device.
I am using the castcompanionlibrary from Google.
If I do
mgr.setStopOnDisconnect(false);
it will not stop the receiver app when the last sender disconnects. If I set it to true
it stops the receiver app even if it is not the only connected sender app.
What do I need to do in the sender app so that it stops the receiver app only when the last sender disconnects? That is, when the user wants to disconnect, I need to check if I am the last/only sender app currently connected and if so, first stop the receiver app and then disconnecting.