[Google Chromecast] HomerSp:
UPDATE 27th November 2014

I have added an Xposed module for the clients below that will work around the issue with Google Play services 6.5 :)

UPDATE 25th November 2014

Google have released Google Play services 6.5 which has strengthened security, effectively making this app useless (clients will be unable to connect). Until Google either loosen the security (which is unlikely to happen), or someone somehow were able to get a hold of the private keys from the chromecast/Android TV this app will no longer work and will no longer be updated.

Thank you all for your support!

Hi everyone! I've decided to finally release my modified Cast Receiver app from the ADT-1 for Android that will work on most devices (though not sure what the minimum api requirement is).

If you don't know what this is it's basically a chromecast receiver for your Android; I use it on my Android mini PC that's hooked up to my TV.

Downloads

Last updated Nov 05 2014.

Recovery install (requires KitKat or newer, or the Xposed module below)

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiaU5WSWRxeC02Tzg

Signed

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiVDR1a1o0WFVSWjg

System install (requires KitKat or newer, or the Xposed module below)

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiNFJGUE1acGZTeFE

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiOTRoanlyX19pVmc

If you are not rooted and can only install it as a regular apk, use the signed version. Note however that casting the screen from another Android device will not work due to a signature mismatch (Google Play Services checks the signatures of the app before allowing screencasting).

If you are rooted you should go for the recovery/system install option, as that will allow screencasting to work.

Xposed module for receiver

If you want to be able to use the system install version on devices older than KitKat you can use the following Xposed module:

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiZEFrN1RqLTRFdkk

Xposed module for client

Version 6.5 and newer of Google Play services makes it impossible to connect to the receiver due to some added security. This Xposed module works around that:

https://docs.google.com/uc?export=download&id=0B4FOzj4b2EYiWG1tU3NfYWwwV00

Install

Recovery install

No special instructions needed, simply copy SYSTEM-CastReceiver.zip to the internal storage (or sdcard) on your device and flash it through your recovery (follow the instructions for your specific recovery).

Signed

Simply install the apk as you would with any apk, either through adb:

adb install -r AndroidMediaShell-signed.apk

or by installing it from your sdcard.

System install

You will need rooted adb for this to work correctly.

If you come from an old install, you can safely remove the old lib first:

adb remount && adb shell rm /system/lib/libmedia_shell_content_view.so

Once that's done, run:

adb remount && adb push libcast_shell_android.so /system/lib/ && adb shell chmod 0644 /system/lib/libcast_shell_android.so
adb remount && adb push AndroidMediaShell.apk /system/priv-app/ && adb shell chmod 0644 /system/priv-app/AndroidMediaShell.apk

(Change priv-app to app on devices older than 4.4)

Running

Amazon Fire TV

Because the Whisperplay app implements a DIAL protocol of its own on port 8008, which the Cast Receiver app also uses and that causes a conflict between the two apps.

To get the app running correctly you need to rename WhisperplayCore.apk:

adb shell mv /system/app/WhisperplayCore.apk /system/app/WhisperplayCore.apk.bak

once that's done, reboot and follow the instructions below.

For the receiver to start you can simply reboot provided you are using the system install. If you are using the signed version you need to run:

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n com.google.android.apps.mediashell/.AutoStartListener

After that it will run automatically in the background after each reboot, so you will be good to go!

Keep in mind that it might take a few minutes for the receiver to show up in the cast list, if it doesn't show after 10 minutes, try rebooting the device.

https://drive.google.com/file/d/0B4FOzj4b2EYiNFRfVDhtZXZGcjg/view?usp=sharing

Supported Apps

Currently not every app is supported. The ones I've tried are:

YouTube - Working

Google Play Music - Working

Google Play Movies & TV - Working

Google+ - Working

Google Photos - Working

Screen Cast - Working (if you follow the instructions above)

Chrome for computer - Working

Netflix - NOT Working (I'm looking into this)

Plex - Working

Chrome for Android - Workinghttps://drive.google.com/file/d/0B4FOzj4b2EYiWVlDTWNGOEw3UTg/view?usp=sharing

Those are the ones I've tried, others may or may not work.

Whether the app will work may also depend on what device you are running the cast receiver on, as well as the region you are in.

FAQ

My device doesn't show up in the official Chromecast app

This is a known "problem" that also affects the ADT-1. There is nothing I can do about it in the Cast Receiver app, only Google can fix it by modifying the Chromecast app. Screen casting etc should work though, it's only the Devices screen that doesn't show any devices.

The receiver doesn't work on my Amazon Fire TV

Please read the instructions under the Running category.

I can't find the receiver device in the cast list

Give it a few minutes. If that doesn't work, try backing out of the app, and enter it again. If it still doesn't show, post a new reply to this thread with a log from logcat.

App X doesn't work

Get me a log when you try to initiate the connection, keeping in mind that some apps may be easier to fix than others. And some may be next to impossible due to them being regional.

How?

I've had some people ask how this was done, so I've written up a list of the changes and a brief summary here:

https://docs.google.com/document/d/1tXnjDdurdoJ4ufulzaqGpuaNpLLt6LGAUk22MO2jta4/edit?usp=sharing

You can get a patch of the smali changes here:

https://drive.google.com/file/d/0B4FOzj4b2EYiTHZBRGVUWmlSV1U/view?usp=sharing

And a bsdiff of the lib changes here:

https://drive.google.com/file/d/0B4FOzj4b2EYiNFRfVDhtZXZGcjg/view?usp=sharing

The source code of the Xposed receiver module can be found here:

https://github.com/HomerSp/XposedCastReceiverFix

The source code of the Xposed client module can be found here:

https://github.com/HomerSp/XposedCastClientFix

And finally here is the code I used while testing the receiver, and writing the MediaDrm and JmDNS code:

https://github.com/HomerSp/CastTest

Changelog

Nov 05, 2014

* Fixed receiver not working while connected to ethernet (may be restricted to the Fire TV)

Oct 29, 2014

* Fixed app not working on API level 15 (tested by me on a real device).

* Disabled logging to file - this should significantly reduce the size of the data that's used by the app.

Oct 26, 2014

* Updated to new 5.0 preview from the ADT-1.

* Lowered API level to 15 on the signed version, keep in mind that this is untested by me. This also includes disabling some DRM API calls that were added in API level 18, so Play Movies will not work on API 17 or lower.

Oct 17, 2014

* Fixed receiver not always starting correctly due to device not being provisioned, thanks to [MENTION=2668759]rkirmeier[/MENTION]!

Oct 10, 2014

* First version!

Finally I would like to give out a big thank you to [MENTION=2975319]death2all110[/MENTION] for doing extensive testing for me, as well as providing me with the system dump from the ADT-1. I couldn't have done this without him! :)

Enjoy! :D