FORUMS
Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

[App] Cast Receiver app for Android

486 posts
Thanks Meter: 325
 
By HomerSp, Retired Recognized Developer on 10th October 2014, 10:28 AM
Post Reply Email Thread
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=do...U5WSWRxeC02Tzg

Signed
https://docs.google.com/uc?export=do...DR1a1o0WFVSWjg

System install (requires KitKat or newer, or the Xposed module below)
https://docs.google.com/uc?export=do...FJGUE1acGZTeFE
https://docs.google.com/uc?export=do...TRoanlyX19pVmc

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=do...EFrN1RqLTRFdkk

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=do...G1tU3NfYWwwV00

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/0B4F...ew?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/1...it?usp=sharing
You can get a patch of the smali changes here:
https://drive.google.com/file/d/0B4F...ew?usp=sharing
And a bsdiff of the lib changes here:
https://drive.google.com/file/d/0B4F...ew?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!
The Following 46 Users Say Thank You to HomerSp For This Useful Post: [ View ] Gift HomerSp Ad-Free
 
 
11th October 2014, 06:04 AM |#2  
Member
Flag Samara
Thanks Meter: 91
 
More
Great! Works flawlessly on my Ouya (CM11). Run on boot via ScriptManager.
The Following User Says Thank You to cbwlkr For This Useful Post: [ View ] Gift cbwlkr Ad-Free
12th October 2014, 04:02 AM |#3  
Senior Member
Flag Illinois
Thanks Meter: 295
 
Donate to Me
More
If you need help with Netflix you know where to find me!
The Following 5 Users Say Thank You to death2all110 For This Useful Post: [ View ] Gift death2all110 Ad-Free
12th October 2014, 05:53 PM |#4  
Junior Member
Thanks Meter: 0
 
More
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!
13th October 2014, 12:04 PM |#5  
HomerSp's Avatar
OP Retired Recognized Developer
Flag Stockholm
Thanks Meter: 325
 
More
Quote:
Originally Posted by krosk

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!
13th October 2014, 01:21 PM |#6  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by HomerSp

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.
13th October 2014, 03:11 PM |#7  
HomerSp's Avatar
OP Retired Recognized Developer
Flag Stockholm
Thanks Meter: 325
 
More
Quote:
Originally Posted by krosk

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.

Of course, I completely misread your post. Sorry!
14th October 2014, 08:31 PM |#8  
Junior Member
Thanks Meter: 1
 
More
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!
15th October 2014, 02:27 AM |#9  
Senior Member
Thanks Meter: 72
 
More
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.
15th October 2014, 09:51 AM |#10  
HomerSp's Avatar
OP Retired Recognized Developer
Flag Stockholm
Thanks Meter: 325
 
More
Quote:
Originally Posted by rkirmeier

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.

Quote:
Originally Posted by astro128

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.
15th October 2014, 03:38 PM |#11  
Senior Member
Thanks Meter: 72
 
More
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?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes