{"action":"created","issue":{"url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/279","repository_url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android","labels_url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/279/labels{/name}","comments_url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/279/comments","events_url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/279/events","html_url":"https://github.com/googlecast/CastCompanionLibrary-android/issues/279","id":136665290,"number":279,"title":"session reconnection doesn't work","user":{"login":"vandzi","id":832796,"avatar_url":"https://avatars.githubusercontent.com/u/832796?v=3","gravatar_id":"","url":"https://api.github.com/users/vandzi","html_url":"https://github.com/vandzi","followers_url":"https://api.github.com/users/vandzi/followers","following_url":"https://api.github.com/users/vandzi/following{/other_user}","gists_url":"https://api.github.com/users/vandzi/gists{/gist_id}","starred_url":"https://api.github.com/users/vandzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vandzi/subscriptions","organizations_url":"https://api.github.com/users/vandzi/orgs","repos_url":"https://api.github.com/users/vandzi/repos","events_url":"https://api.github.com/users/vandzi/events{/privacy}","received_events_url":"https://api.github.com/users/vandzi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-02-26T11:04:57Z","updated_at":"2016-02-26T16:31:05Z","closed_at":null,"body":"I am not able to reconnect to session after wifi is off(ie 30 seconds) and then on again, even if i increase reconnection attempt reconnection attempt time to 120seconds.\r\nProblem seems to be that after cca 10-15 seconds,   CastMediaRouterCallback calls method:\r\n\r\n@Override\r\n    public void onRouteUnselected(MediaRouter router, RouteInfo routeInfo) {\r\n        LOGD(TAG, \"onRouteUnselected: route=\" + routeInfo);\r\n        mCastManager.onDeviceSelected(null, routeInfo);\r\n    }\r\n\r\nmCastManager.onDeviceSelected triggers disconnectDevice() which clears persistent data which are required for reconnection.\r\n\r\nLogs from network change until onRouteUnselected call:\r\n\r\n02-26 11:40:15.492 18818-18818/com.testD/ccl_ReconnectionService: [v2.8.0] WIFI connectivity changed to disabled\r\n        02-26 11:40:15.652 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onConnectionSuspended() was called with cause: 2\r\n        02-26 11:40:15.732 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onConnectionSuspended() was called with cause: 2\r\n        02-26 11:40:15.772 18818-18818/com.testD/ccl_ReconnectionService: [v2.8.0] WIFI connectivity changed to disabled\r\n        02-26 11:40:30.912 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onConnectionFailed() reached, error code: 7, reason: ConnectionResult{statusCode=NETWORK_ERROR, resolution=null, message=null}\r\n        02-26 11:40:30.912 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] disconnectDevice(false,false)\r\n        02-26 11:40:30.912 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] disconnectDevice() Disconnect Reason: Connectivity lost\r\n        02-26 11:40:30.912 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] mConnectionSuspended: true\r\n        02-26 11:40:37.022 18818-18818/com.testD/ccl_VideoCastManager: [v2.8.0] trying to detach media channel\r\n        02-26 11:40:37.022 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onDisconnected() reached\r\n\r\n        [ 02-26 11:40:37.022 18818:18818 V/         ]\r\n        chromecast onDisconnected\r\n\r\n        [ 02-26 11:40:37.022 18818:18818 V/         ]\r\n        chromecast session length in seconds: 454\r\n        02-26 11:40:37.562 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] reconnectSessionIfPossible(120, null)\r\n        02-26 11:40:37.562 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] Found session info in the preferences, so proceed with an attempt to reconnect if possible\r\n        02-26 11:40:37.582 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] reconnectSessionIfPossible() Retrieved from preferences: sessionId=5FC476B2-9A84-4E8E-A34E-4EA33D27F7EA, routeId=com.google.android.gms/.cast.media.CastMediaRouteProviderService:d31f1cedc896b36b96c780ab16b15eeb\r\n        02-26 11:40:37.612 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] trying to acquire Cast Client for \"Chromecast\" (d31f1cedc896b36b96c780ab16b15eeb)\r\n        02-26 11:40:39.532 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] acquiring a connection to Google Play services for \"Chromecast\" (d31f1cedc896b36b96c780ab16b15eeb)\r\n        02-26 11:40:39.572 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 1\r\n        02-26 11:40:40.192 18818-18818/com.testD/ccl_VideoCastManager: [v2.8.0] updateMiniControllersVisibility() reached with visibility: false\r\n        02-26 11:40:40.232 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onConnectionFailed() reached, error code: 7, reason: ConnectionResult{statusCode=NETWORK_ERROR, resolution=null, message=null}\r\n        02-26 11:40:40.242 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] disconnectDevice(false,false)\r\n        02-26 11:40:40.242 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] disconnectDevice() Disconnect Reason: Intentional disconnect\r\n        02-26 11:40:40.242 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] mConnectionSuspended: false\r\n        02-26 11:40:40.642 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 2\r\n        02-26 11:40:41.642 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 3\r\n        02-26 11:40:42.652 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 4\r\n        02-26 11:40:43.652 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 5\r\n        02-26 11:40:44.652 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 6\r\n        02-26 11:40:45.652 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 7\r\n        02-26 11:40:46.662 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 8\r\n        02-26 11:40:47.662 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 9\r\n        02-26 11:40:48.662 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 10\r\n        02-26 11:40:49.662 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 11\r\n        02-26 11:40:50.672 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 12\r\n        02-26 11:40:51.672 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 13\r\n        02-26 11:40:52.672 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 14\r\n        02-26 11:40:53.682 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 15\r\n        02-26 11:40:54.682 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 16\r\n        02-26 11:40:55.682 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 17\r\n        02-26 11:40:56.692 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 18\r\n        02-26 11:40:57.692 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 19\r\n        02-26 11:40:58.692 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 20\r\n        02-26 11:40:59.692 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 21\r\n        02-26 11:41:00.692 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 22\r\n        02-26 11:41:01.702 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 23\r\n        02-26 11:41:02.702 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 24\r\n        02-26 11:41:03.702 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 25\r\n        02-26 11:41:04.462 18818-18818/com.testD/ccl_VideoCastManager: [v2.8.0] trying to detach media channel\r\n        02-26 11:41:04.462 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] onDisconnected() reached\r\n\r\n        [ 02-26 11:41:04.462 18818:18818 V/         ]\r\n        chromecast onDisconnected\r\n        02-26 11:41:04.472 18818-18818/com.testD/ccl_VideoCastManager: [v2.8.0] updateMiniControllersVisibility() reached with visibility: false\r\n        02-26 11:41:04.712 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 26\r\n        02-26 11:41:05.722 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 27\r\n        02-26 11:41:06.162 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] reconnectSessionIfPossible(120, null)\r\n        02-26 11:41:06.162 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] Found session info in the preferences, so proceed with an attempt to reconnect if possible\r\n        02-26 11:41:06.162 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] reconnectSessionIfPossible() Retrieved from preferences: sessionId=5FC476B2-9A84-4E8E-A34E-4EA33D27F7EA, routeId=com.google.android.gms/.cast.media.CastMediaRouteProviderService:d31f1cedc896b36b96c780ab16b15eeb\r\n        02-26 11:41:06.162 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] trying to acquire Cast Client for \"Chromecast\" (d31f1cedc896b36b96c780ab16b15eeb)\r\n        02-26 11:41:06.732 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 28\r\n        02-26 11:41:07.742 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 29\r\n        02-26 11:41:08.022 18818-18818/com.testD/ccl_BaseCastManager: [v2.8.0] acquiring a connection to Google Play services for \"Chromecast\" (d31f1cedc896b36b96c780ab16b15eeb)\r\n        02-26 11:41:08.042 18818-18964/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 1\r\n        02-26 11:41:08.102 18818-21936/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 30\r\n        02-26 11:41:09.142 18818-18964/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 2\r\n        02-26 11:41:09.732 18818-18818/com.testD/ccl_CastMediaRouterCal: [v2.8.0] onRouteUnselected: route=MediaRouter.RouteInfo{ uniqueId=com.google.android.gms/.cast.media.CastMediaRouteProviderService:d31f1cedc896b36b96c780ab16b15eeb, name=Chromecast, description=Now Casting: Shrinking and Rethinking: Retailers to Seek Web…, iconUri=null, enabled=true, connecting=true, connectionState=0, canDisconnect=false, playbackType=1, playbackStream=-1, deviceType=0, volumeHandling=0, volume=0, volumeMax=20, presentationDisplayId=-1, extras=Bundle[{com.google.android.gms.cast.EXTRA_CAST_DEVICE=\"Chromecast\" (d31f1cedc896b36b96c780ab16b15eeb)}], settingsIntent=null, providerPackageName=com.google.android.gms }\r\n        02-26 11:41:10.142 18818-18964/com.testD/ccl_BaseCastManager: [v2.8.0] Reconnection: Attempt 3"},"comment":{"url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/comments/189359556","html_url":"https://github.com/googlecast/CastCompanionLibrary-android/issues/279#issuecomment-189359556","issue_url":"https://api.github.com/repos/googlecast/CastCompanionLibrary-android/issues/279","id":189359556,"user":{"login":"vandzi","id":832796,"avatar_url":"https://avatars.githubusercontent.com/u/832796?v=3","gravatar_id":"","url":"https://api.github.com/users/vandzi","html_url":"https://github.com/vandzi","followers_url":"https://api.github.com/users/vandzi/followers","following_url":"https://api.github.com/users/vandzi/following{/other_user}","gists_url":"https://api.github.com/users/vandzi/gists{/gist_id}","starred_url":"https://api.github.com/users/vandzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vandzi/subscriptions","organizations_url":"https://api.github.com/users/vandzi/orgs","repos_url":"https://api.github.com/users/vandzi/repos","events_url":"https://api.github.com/users/vandzi/events{/privacy}","received_events_url":"https://api.github.com/users/vandzi/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T16:31:05Z","updated_at":"2016-02-26T16:31:05Z","body":"Yes, I will on Monday."}}