[App] Cast Receiver app for Android

Search This thread

HomerSp

Retired Recognized Developer
Jan 5, 2010
621
591
Stockholm
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:
Code:
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:
Code:
adb remount && adb shell rm /system/lib/libmedia_shell_content_view.so

Once that's done, run:
Code:
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:
Code:
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:
Code:
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 @rkirmeier!

Oct 10, 2014
* First version!

Finally I would like to give out a big thank you to @death2all110 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
 
Last edited:

krosk

New member
Feb 23, 2008
3
0
Hi,
First of all, thanks, because this works nicely with my laptop! I can finally cast to my living room tv that has an android device connected.
I can cast from Chrome browser (Cast Extension) on OS X, but can't from a 4.2 Android handset (I've tried youtube and google play music). Whenever I try to connect to the Server on a 4.4 radxa rock, the server disappears from the list. It comes back after 10 seconds more or less. Can I help with debug logs or something?
Thanks!
 

HomerSp

Retired Recognized Developer
Jan 5, 2010
621
591
Stockholm
Hi,
First of all, thanks, because this works nicely with my laptop! I can finally cast to my living room tv that has an android device connected.
I can cast from Chrome browser (Cast Extension) on OS X, but can't from a 4.2 Android handset (I've tried youtube and google play music). Whenever I try to connect to the Server on a 4.4 radxa rock, the server disappears from the list. It comes back after 10 seconds more or less. Can I help with debug logs or something?
Thanks!
Do you mean 4.2 or 4.4 (you mentioned both)? I haven't tried compatibility with 4.2, but 4.4 should definitely work. In any case, I would need a logcat from the receiver device to be able to see what's wrong.
@death2all110 I probably will, yes. It seems to be restricted to the US for now - I've tried hard-coding a proxy in the code, which makes it go further, but not far enough for it to work. I'll get back to you when I have something for you to test! :)
 

krosk

New member
Feb 23, 2008
3
0
Do you mean 4.2 or 4.4 (you mentioned both)? I haven't tried compatibility with 4.2, but 4.4 should definitely work. In any case, I would need a logcat from the receiver device to be able to see what's wrong.

My phone (4.2) is not connecting to the server (screen) in 4.4. Your app is installed in the 4.4 device. I will send you logs later.
 

astro128

Member
Jul 6, 2014
7
3
Nexus Q Install?

Any chance this can be installed onto a Nexus Q - I would love to get my Q-Ball back up and running!
 

rkirmeier

Senior Member
Jun 18, 2010
383
72
Im not having any luck on a minix 8h (stock rooted rom - 4.4.2) or Note 12.2 running cm11. Same thing happens for me. Devices show up in the list but when you try to connect it fails and that device disappears from the list for a little while. I installed using root explorer by putting the files in the respected folders then setting the correct permissions and rebooting.
 

HomerSp

Retired Recognized Developer
Jan 5, 2010
621
591
Stockholm
Im not having any luck on a minix 8h (stock rooted rom - 4.4.2) or Note 12.2 running cm11. Same thing happens for me. Devices show up in the list but when you try to connect it fails and that device disappears from the list for a little while. I installed using root explorer by putting the files in the respected folders then setting the correct permissions and rebooting.
What version of Google play services do you have installed on the sender device? Also, a logcat from the receiver would be useful.

astro128 said:
Nexus Q Install?
Any chance this can be installed onto a Nexus Q - I would love to get my Q-Ball back up and running!
I don't own a Nexus Q myself, so I won't be able to do any testing. The Q is running a full Android system, right? If it is, the receiver app most likely requires a later API version, or the Q doesn't support some of the features the cast receiver app requires to function.
 
Last edited:

rkirmeier

Senior Member
Jun 18, 2010
383
72
I'm casting from a LG G3 and the Google Play services is on version 6.1.74
How can I send you the logcat? Can you PM me your email address?
 

rkirmeier

Senior Member
Jun 18, 2010
383
72
Am I right in assuming that's from your phone? I would need one from the receiver (your X8) because the sender wouldn't output any logging if there was anything wrong, but the receiver will :)

That is correct. I'll work on getting the log from my minix and tablet tonight as they both have the receiver installed and do the same thing.
 

HomerSp

Retired Recognized Developer
Jan 5, 2010
621
591
Stockholm
Minix log attached...

Thanks!
Okay, I know why it happens now, but not the reason unfortunately. Do you think that you would be able to get a new log when you restart the media shell service? You should be able to connect to the Minix through the local network using ADB Konnect (https://play.google.com/store/apps/details?id=com.rockolabs.adbkonnect). Simply run ADB Konnect on the device and start the connection, then from your computer run:
adb connect <ip>
adb logcat

From another terminal run:
adb shell am force-stop com.google.android.apps.mediashell
adb shell am startservice -n com.google.android.apps.mediashell/.MediaShellCastReceiverService

The problem is that the signature that is used for device authentication is empty for some reason, and your log doesn't say why (the signature is generated when the service is first started).
 

rkirmeier

Senior Member
Jun 18, 2010
383
72
Okay, I know why it happens now, but not the reason unfortunately. Do you think that you would be able to get a new log when you restart the media shell service? You should be able to connect to the Minix through the local network using ADB Konnect (https://play.google.com/store/apps/details?id=com.rockolabs.adbkonnect). Simply run ADB Konnect on the device and start the connection, then from your computer run:
adb connect <ip>
adb logcat

From another terminal run:
adb shell am force-stop com.google.android.apps.mediashell
adb shell am startservice -n com.google.android.apps.mediashell/.MediaShellCastReceiverService

The problem is that the signature that is used for device authentication is empty for some reason, and your log doesn't say why (the signature is generated when the service is first started).

I'm mostly new to adb other then a dozen or so roots I have applied (by guide) so I'm not sure if I'm doing something wrong here or what. I can connect from both computers and on the device I enter logcat then replies with "- waiting for device -". I know I"m connected because if I try to connect again it says I'm already connected. From the other computer I get the same response for logcat and when I enter your other commands to stop/start the service I get "error: device offline"

Any ideas to work around these issues? I would really like to get you the logs as it seems to be a common issue.
 

HomerSp

Retired Recognized Developer
Jan 5, 2010
621
591
Stockholm
I'm mostly new to adb other then a dozen or so roots I have applied (by guide) so I'm not sure if I'm doing something wrong here or what. I can connect from both computers and on the device I enter logcat then replies with "- waiting for device -". I know I"m connected because if I try to connect again it says I'm already connected. From the other computer I get the same response for logcat and when I enter your other commands to stop/start the service I get "error: device offline"

Any ideas to work around these issues? I would really like to get you the logs as it seems to be a common issue.
Is USB debugging enabled on the Minix? Settings > Developer options > USB debugging should be ticked.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    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:
    Code:
    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:
    Code:
    adb remount && adb shell rm /system/lib/libmedia_shell_content_view.so

    Once that's done, run:
    Code:
    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:
    Code:
    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:
    Code:
    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 @rkirmeier!

    Oct 10, 2014
    * First version!

    Finally I would like to give out a big thank you to @death2all110 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
    7
    The Xposed module approach sounds good as well, or are you thinking that's not as feasible now?
    I've written an Xposed module that allows the client to connect. I'm just in the process of testing it at the moment, so I will upload it in the coming days (probably tomorrow).
    7
    Good news, everyone! (yes, actual good news)
    Thanks to @death2all110 I was able to get Netflix up and running! :D There are still some things I'd like to fix before releasing it, but Netflix support is coming!
    5
    If you need help with Netflix you know where to find me!
    4
    I am wrapping up a test version, and will post in a separate thread here in xda forums.