Search code examples
chromecastgoogle-cast

Would it make sense to try to reconnect to Chromecast with the disconnect reason is BaseCastManager.DISCONNECT_REASON_CONNECTIVITY?


I noticed a event method on the Cast Companion Library called onDisconnectionReason and one of the reasons is BaseCastManager.DISCONNECT_REASON_CONNECTIVITY. Would it make sense for my code to attempt to automatically reconnect to the Chromecast when that happens?

Thanks.


Solution

  • You can try but there is a (large) possibility that it will fail since usually you first get a transient disconnect when there is a network issue and the SDK tries to reconnect for a certain length of time (I don't recall, something like 10 seconds or so) and then gives up if there is a real network issue. So if there is such an issue, it is likely that an immediate attempt to reconnect will fail too but it is not harmfull if you don't make it too long or not to continue for an extended period of time.