2

I have downloaded and built the CastCompanionLibrary and CastVideos-android sample code from github, after updating google play services library etc.

I have modified the strings file to enter my AppId.

I have a test device configured in the developer console, and also I configured an app (is the sample video app in this case) and I entered the same package name as in the AndroidManifest.xml for the app.

The app start, runs and shows lists of videos - but does not seem to detect the chromecast device as on button is added to the ActionBar.

I am now trying to publish the sample app to see if that fixes it, but following the instructions and using the stock sample code is not working for me so far.

What am I doing wrong?

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
  • So far, the only way I can get the chromecast device to show-up in the sample apps I have compiled (after fixing other issues) is to publish the app! So, looking into this whitelisting issue.... – Andrew Mackenzie Feb 16 '14 at 12:36

5 Answers5

1

Andrew, which XML file you were referring to that had Pay Service version stuff in it? As to your issue, my suggestion is:

(1) Make sure your devices is whitelisted for your app. I imagine you are creating an app id on the dev console and using that app id. If your device is whitelisted, you should be able to access it using a chrome browser at http://<chromecast-ip>:9222, if you cannot access that, your device is not whitelisted. To troubleshoot, take a look at this post.

(2) After your device is set up for development, then make sure you put the app id in the strings.xml. Make sure your dependencies are set correctly: the companion library depends on appcompat and mediarouter from v7 of the support libraries, and rev 15 of play store library. The CastVideos-android only depends on the companion library.

If you follow these steps, all should work.

Community
  • 1
  • 1
Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28
  • I´d all that correct, but haven´t checked the whitelisting yet. I ended up publishing my app, and that has fixed it. I will look at whitelisting now. – Andrew Mackenzie Feb 15 '14 at 21:18
  • The reference was in AndroidManifest.xml in fact, in this meta-data tag: but the attribute didn't exist in the project, so I added it. The first time I got it wrong and Logcat spat out an error telling me to use the 4242000 value. – Andrew Mackenzie Feb 15 '14 at 22:05
  • You shouldn't define that in your own resources; the Google Play services lib has that resource; that is why you don't find that in the sample project. – Ali Naddaf Feb 15 '14 at 22:11
  • You're right. I think I initially had a problem with the resources from the play lib module, and I fixed it in this case by adding. Then later I fixed the resource problem from play lib project and so it is now not needed. Thanks! – Andrew Mackenzie Feb 16 '14 at 11:53
1

OK here is my summary of things I had to do to get things working with an unpublished app:

  • Double-check the Device ID. It's difficult to read and some characters could be wrong. Taking a photo in good lighting is a good idea.

  • Configure the device in the dev console (https://cast.google.com/publish/#/overview), register it and wait. Then later I had to reboot my Chromecast device (in fact twice). I used the chromecast app (Mac OS X) which you can download from here: https://cast.google.com/chromecast/setup

  • I had poor Wi-Fi performance that made my Android device change WiFi SSID to a different one from where the ChromeCast was connected. Latest versions of Android seem to test response time and bandwidth and then may change if deemed "unstable" (I had it overloaded with downloads) and there is another better one available. So, double check you are on the correct WiFi on Android.

  • Off course, configure the app in the dev console and past the (Case Sensitive) app id into the app_id string in the strings.xml file in the Android res/values folder.

I think that´s all. Happy casting!

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
  • You can also get the Device ID from the box. That's why I always take photo's of the labels on boxes: usually better readable than what's on the devices. – Jeroen Wiert Pluimers Feb 16 '14 at 16:20
  • 1
    The only number I see on the box is completely different from the device ID, and starts with an 'X' (letter) and so according to google not a device id, which starts with a number (either 3, 6 or 8 I seem to recall). – Andrew Mackenzie Feb 16 '14 at 16:38
  • I checked to pictures I took of the Chromecasts and they all have 2 barcodes; the big lower barcode has the UPC ([81157101357](https://www.google.com/search?q=81157101357)) and the smaller top barcode has the serial number. What's the UPC on your boxes? – Jeroen Wiert Pluimers Feb 16 '14 at 21:26
0

I have the exact same issue, the cast video sample app doesn't find my chromecast so it doesn't show the "cast button" in the action bar.

Like you, in https://cast.google.com/publish/#/overview i have set up a new Styled Media Receiver application with the Android platform and set the package name to : com.google.sample.cast.refplayer

Then i found this : https://developers.google.com/cast/docs/receiver_apps#default So i changed CastApplication.java in the onCreate method : APPLICATION_ID = CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID;

Now it works, i can see the cast button and send videos to my chromecast. But i still can't use my own application to use my own receiver.

Kerwan
  • 1,188
  • 1
  • 9
  • 12
  • 1
    That means your device is not whitelisted for your app correctly. – Ali Naddaf Feb 15 '14 at 20:45
  • Yes you're right thank you ! I followed the instructions here http://stackoverflow.com/a/21619494/2765813 since i couldn't access to my chromecast with http://:9222 and "Send the serial number" checkbox in the chromecast app was not checked. Once i did and rebooted, my custom receiver application worked ! – Kerwan Feb 15 '14 at 22:53
0

I published my application from the Cast developer console (https://cast.google.com/publish/#/overview) and that seems to have fixed it.

BTW: Other people may have had uppercase/lowercase problems with the app ID - but not me.

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
0

I took the advice of some google page, and took a photograph of my Chromecast close up....with that unreadable laser etched ID.....

Then I zoomed in and checked.....and yes, I had a '8' instead of a 'B' in my device ID, probably causing my device to be not WhiteListed as mentioned by Ali Naddaf.

I deleted the old device, and created a new one with the correct Device ID. Then I had to wait 15mins for it to be registered.

So, I changed the package name of the sample in AndroidManifest.xml, I created a new Android app in the dev console with that package name, and put the new App Id into the code (strings.xml) and rebuilt and deployed my Android app.

All that did NOT work and the chromecast did not appear......so for now, using a published app is the only thing that works for me.

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
  • Is your device now whitelisted Can you access the debug port 9222 on that? If not, you will not be able to use any receiver of your own, so you need to address that first before attempting to run any app. – Ali Naddaf Feb 15 '14 at 22:12
  • 1
    Seems my WiFi was a bit flaky (or overloaded) and sometimes my phone was auto-selecting a different access point to the one the ChromeCast is on. All good now, and I have got working with a styled media receiver too. – Andrew Mackenzie Feb 16 '14 at 12:31