cc5zhenhua
cc5zhenhua

Reputation: 145

How to make MediaRouter disconnected during onStop or onPause

I have my cast receiver app stopped in the mainactivity onStop or onPause. When resume the Mainactivity, MediaRouterActionProvider Menu item Dialog is still connected. Is there any method to disconnect them and make the MediaRouterActionProvider back to MediaRoute Chooser dialog?

Upvotes: 0

Views: 149

Answers (1)

Ali Naddaf
Ali Naddaf

Reputation: 19094

When you say your receiver app is stopped, do you mean you have called stopApplication() or do you mean you have called stop() on the RemoteMediaPlayer? stopApplication practically disconnects your app. If that is the case, you need to add logic to capture that and clean up things a bit. A manual way to make the Cast button look disconnected is to call mMediaRouter.selectRoute(mMediaRouter.getDefaultRoute())

Upvotes: 2

Related Questions