I'm trying to figure out the correct way to add Chromecast buttons (pause, play, etc.) in an Android notification. I created a custom notification that sends PendingIntents to the ChromecastService. This service is trying to interact with the ChromecastAdapter class that I created. The ChromecastAdapter implements the MediaRouteAdapter and contains all the listeners and state that come with the casting. However, all this state goes away as soon as I exit the application. So, my ChromecastService does not have access to Chromecast as soon as my application disappears.
It seems to me that the only way to get this to work is to reorganize the entire state of Chromecast into a service that implements MediaRouteAdapter. I really do not want to do this, as I am pleased with how everything is happening now.
Since these interactive notifications are required by Google, I feel that there should be a standard way to interact with the act from the Notification. Am I here on the right track? Should I host all my Chromecast interactions behind the Service?
. "" ( , ), , , , , ; , , , , , .
, , , , , (, ), . "" . // , "" . , "" , , (, - ), .