ConnectSDK / Connect-SDK-Android

Android source project for Connect SDK
Apache License 2.0
300 stars 130 forks source link

FireTV discovery doesn't always work #278

Open casolorz opened 9 years ago

casolorz commented 9 years ago

I don't know if this is an issue with the FireTV software or ConnectSDK but basically if I run my app on a few devices at the same time (this time I'm testing on 6), only a few will find the Fire TV. The devices don't seem to matter as much as sometimes they will find it and sometimes they won't find it.

Here is a log from one that didn't find the FireTV:

07-11 13:19:48.168 29777-29777/? D/Connect SDK﹕ Service added: Nearby device (Chromecast) 07-11 13:19:48.168 29777-29777/? D/Connect SDK﹕ Adding service Chromecast to device with address 127.0.0.1 and id 5e7fd339-1785-429b-8537-41fad511861f 07-11 13:20:53.353 30660-30660/? D/Connect SDK﹕ Service added: Living room (DIAL) 07-11 13:20:53.355 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.66 and id 2a325b6a-9f70-490d-86fd-d4cfb56220a5 07-11 13:20:53.372 30660-30660/? D/Connect SDK﹕ Service added: HT-RC460 (DLNA) 07-11 13:20:53.373 30660-30660/? D/Connect SDK﹕ Adding service DLNA to device with address 192.168.1.91 and id 212300f5-9bcd-438b-b236-7dca535a2b10 07-11 13:20:53.382 30660-30660/? D/Connect SDK﹕ Service added: HT-RC460 (Netcast TV) 07-11 13:20:53.382 30660-30660/? D/Connect SDK﹕ Adding service Netcast TV to device with address 192.168.1.91 and id 212300f5-9bcd-438b-b236-7dca535a2b10 07-11 13:20:53.418 30660-30660/? D/Connect SDK﹕ Service added: Gym (DIAL) 07-11 13:20:53.419 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.67 and id 17abd810-227e-4db9-b0ca-7f2ee7030edd 07-11 13:20:53.520 30660-30660/? D/Connect SDK﹕ Service added: TV-55C6400 (DLNA) 07-11 13:20:53.521 30660-30660/? D/Connect SDK﹕ Adding service DLNA to device with address 192.168.1.90 and id 5f548a95-459b-47e5-bb19-2a4df4e48453 07-11 13:20:53.522 30660-30660/? D/Connect SDK﹕ Service added: TV-55C6400 (Netcast TV) 07-11 13:20:53.522 30660-30660/? D/Connect SDK﹕ Adding service Netcast TV to device with address 192.168.1.90 and id 5f548a95-459b-47e5-bb19-2a4df4e48453 07-11 13:20:53.834 30660-30660/? D/Connect SDK﹕ Service added: Lilian's Fire TV (DIAL) 07-11 13:20:53.835 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.72 and id 04d670ca-a063-4320-bab6-fe9a377b612e 07-11 13:20:54.116 30660-30660/? D/Connect SDK﹕ Service added: Roku 3 - 4124CD116856 (Roku) 07-11 13:20:54.117 30660-30660/? D/Connect SDK﹕ Adding service Roku to device with address 192.168.1.212 and id d4e1ac6c-9502-4c29-a65f-8ded3837ba23 07-11 13:20:54.493 30660-30660/? D/Connect SDK﹕ Service added: Nearby device (Chromecast) 07-11 13:20:54.494 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 127.0.0.1 and id 3ada76c4-cac8-464e-b1a0-2e37a73faed8 07-11 13:20:54.833 30660-30660/? D/Connect SDK﹕ Service added: Living room (Chromecast) 07-11 13:20:54.833 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 192.168.1.66 and id 2a325b6a-9f70-490d-86fd-d4cfb56220a5 07-11 13:20:54.843 30660-30660/? D/Connect SDK﹕ Service added: Master bedroom (Chromecast) 07-11 13:20:54.844 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 192.168.1.74 and id 9af4a451-e860-463f-ba3e-db65f97ddd95 07-11 13:20:54.853 30660-30660/? D/Connect SDK﹕ Service added: Basement east bedroom (Chromecast) 07-11 13:20:54.854 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 192.168.1.69 and id d5d2ba93-45d0-4dc6-b2fc-69e2d5461803 07-11 13:20:54.866 30660-30660/? D/Connect SDK﹕ Service added: Gym (Chromecast) 07-11 13:20:54.866 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 192.168.1.67 and id 17abd810-227e-4db9-b0ca-7f2ee7030edd 07-11 13:20:54.904 30660-30660/? D/Connect SDK﹕ Service added: Master bedroom (DIAL) 07-11 13:20:54.904 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.74 and id 9af4a451-e860-463f-ba3e-db65f97ddd95 07-11 13:20:55.306 30660-30660/? D/Connect SDK﹕ Service added: Basement east bedroom (DIAL) 07-11 13:20:55.306 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.69 and id d5d2ba93-45d0-4dc6-b2fc-69e2d5461803 07-11 13:20:55.543 30660-30660/? D/Connect SDK﹕ Service added: Roku 3 - 4124CD116856 (DIAL) 07-11 13:20:55.543 30660-30660/? D/Connect SDK﹕ Adding service DIAL to device with address 192.168.1.212 and id d4e1ac6c-9502-4c29-a65f-8ded3837ba23 07-11 13:20:57.841 30660-31033/? D/Connect SDK﹕ Service [Nearby device] has been removed 07-11 13:20:57.842 30660-30660/? D/Connect SDK﹕ onServiceRemoved: friendlyName: Nearby device 07-11 13:22:06.216 30660-30660/? D/Connect SDK﹕ Service added: Nearby device (Chromecast) 07-11 13:22:06.216 30660-30660/? D/Connect SDK﹕ Adding service Chromecast to device with address 127.0.0.1 and id 4e9385f1-4076-4149-9236-16d96c28e78e

oleksii-frolov commented 9 years ago

Well, Are you sure that you have Connect-SDK-Android with FireTV module? It is not available only when you compile it from source (not from Maven repository). DiscoveryProvider is a thin wrapper of Fling SDK. Could you please debug more to find the problem?

casolorz commented 9 years ago

Yes it is configured correctly. Like I said running the exact same code on multiple phones leads to some of them finding it and some of them don't find it. The way I run my code is by using the "play" button on Android Studio and then selecting all my phones on the device chooser dialog with the mouse and the shift key, so it literally installs and runs the same apk on all of them.

I've done a lot more testing since I made this ticket and I haven't found any obvious patterns, the FireTV disappears and reappears on the same phone from one run to another. I just had this happen on my Nexus 5 an hour or so ago, the FireTV was nowhere to be found then all of the sudden it was back, from the time it was gone to the time is was back must have been somewhere between five and ten minutes.

Anyways I would be glad to debug more, just tell me what information you need and how to get it.

oleksii-frolov commented 9 years ago

You can check that in FireTVDiscoveryProvider class discoveryController.start was called during discovery and log these events playerDiscovered, playerLost, discoveryFailure. If none of them is called the issue is inside Fling SDK.

casolorz commented 9 years ago

I got some logs of most method calls on the FireTVDiscoveryProvider. I don't know when the FireTV disappeared because I wasn't focused on testing it. At 11:33 is when I press my picker button and those logs show what devices are available prior to my filter check.

07-15 11:21:49.338    5256-5256/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ stop called
07-15 11:21:49.339    5256-5256/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:21:49.513    5256-5256/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:21:56.632    5256-5821/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ playerDiscovered called
07-15 11:21:56.635    5256-5821/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ updateServiceDescription called
07-15 11:21:56.636    5256-5821/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ notifyListenersThatServiceAdded called
07-15 11:27:31.215  15424-15424/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ stop called
07-15 11:27:31.215  15424-15424/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:27:31.393  15424-15424/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:27:37.597  15424-15898/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ playerDiscovered called
07-15 11:27:37.598  15424-15898/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ updateServiceDescription called
07-15 11:27:37.603  15424-15898/? I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ notifyListenersThatServiceAdded called
07-15 11:29:42.614  19076-19076/MyPackage I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ stop called
07-15 11:29:42.614  19076-19076/MyPackage I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:29:42.916  19076-19076/MyPackage I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:30:20.666  20228-20228/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ stop called
07-15 11:30:20.666  20228-20228/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:30:21.655  20228-20228/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ start called
07-15 11:30:28.040  20228-20521/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ playerDiscovered called
07-15 11:30:28.041  20228-20521/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ updateServiceDescription called
07-15 11:30:28.045  20228-20521/MyPackage:leakcanary I/com.connectsdk.discovery.provider.FireTVDiscoveryProvider﹕ notifyListenersThatServiceAdded called
07-15 11:33:41.771  19076-19076/MyPackage W/MyClass﹕ Connected services for Master bedroom are DIAL
07-15 11:33:41.772  19076-19076/MyPackage W/MyClass﹕ Connected services for Gym are DIAL
07-15 11:33:41.772  19076-19076/MyPackage W/MyClass﹕ Connected services for Living room are DIAL
07-15 11:33:41.772  19076-19076/MyPackage W/MyClass﹕ Connected services for Basement east bedroom are DIAL
07-15 11:33:41.773  19076-19076/MyPackage W/MyClass﹕ Connected services for TV-55C6400 are DLNA
07-15 11:33:41.773  19076-19076/MyPackage W/MyClass﹕ Connected services for Roku 3 - 4124CD116856 are DIAL, Roku
07-15 11:33:41.774  19076-19076/MyPackage W/MyClass﹕ Connected services for Apple TV (2) are AirPlay
07-15 11:33:41.775  19076-19076/MyPackage W/MyClass﹕ Connected services for HT-RC460 are DLNA
07-15 11:33:41.775  19076-19076/MyPackage W/MyClass﹕ Connected services for Living room Fire TV are DIAL 

On ticket #273 you can see that the FireTV was there at 11:10. Sorry Android Studio is not giving me logs between those two times.

07-15 11:10:35.271 19342-19342/mypackage W/MyClass﹕ Connected services for Living room Fire TV are DIAL
07-15 11:10:35.271 19342-19342/mypackage W/MyClass﹕ Connected services for Living room Fire TV are FireTV
kun510 commented 2 months ago

I want to connect to Fire TV without using DIAL, but want to use Fling but when I connect using DIAL it displays on the firetv device but fling does not display, please help me