Discovery of Chromecast devices using Android MediaRouter APIs is not working as expected with latest mediarouter support library (version 19) and google play services version 4.2.43.
I'm using Cast Hello Text sample app for this issue. It can be found here: https://github.com/googlecast/CastHelloText-android.
I have my chromecast device plugged into the TV and in the same network as the Android device (Sender).
The app comes up and finds the Chromecast device. I override some of the relevant MediaRouter.Callback methods, so I see the onRouteAdded() being called.
Later, I unplug the device from my TV. I expect to get a onRouteRemoved() event. But this never happens.
The app still displays the cast icon. On selecting the device from the cast icon, the app attempts to connect to the device and fails. Now I get onRouteUnSelected() and onRouteRemoved() events and the cast icon disappears.
On plugging back the device to my TV and once the device is displaying the home screen, I expect to get a onRouteAdded() event. I do not get this event even after waiting for a few minutes.
This was working as expected in mediarouter library version 17 and with the preview google cast SDK.
So has something changed in terms of when these events are fired?
what is the right way to find out when a chromecast device is added and when it is removed? I plan on using a custom UI with MediaRouter APIs to display the cast icon and the device list.
There is a bug in the latest version of Android SDK/Play services that causes the behavior you are seeing. This will be fixed in the next release of SDK and Google Play services.
Related
I am creating a Chromecast sender app. Previously a built-in Chromecast version was 1.36.xxx and the Android sender app was able to detect the Chromecast device using the following code:
castContext = CastContext.getSharedInstance(applicationContext);
router = MediaRouter.getInstance(applicationContext);
However, I've just upgraded my built-in Chromecast to version 1.42.xxx (which according to this: https://support.google.com/chromecast/answer/7124014?hl=en-GB is 2nd generation Chromecast) and after this upgrade the Chromecast device is no longer detectible in my Android sender app.
Has anyone encountered this before? Could there be an issue with the Chromecast receiver app not being compatible with 2nd generation devices?
Note: I am using an unpublished receiver app - however, my Chromecast device has been registered with the serial number. Also, this is using the Built-in Chromecast app for AndroidTVs.
We are using com.google.android.gms:play-services-cast-framework:17.1.0
If you have an Android TV, I don't think you can use the firmware for the generation 2 chromecast device. According to https://support.google.com/chromecast/answer/7124014?hl=en the latest version for Android TV is:
Cast for Android TV — Firmware version 1.36154871
I have an Android app which interacts with custom BLE devices. This app works as expected on devices which have android version 4.4 to 6.0. Now I want to make this available on Chromebooks through the Google Playstore on Chromebooks(App Runtime for Chrome).
I installed this app on my Google Asus Flip Chromebook(Chrome OS version 55, ARC version 3617689) by sideloading the APK onto it. But it is not working as expected.
These are the steps I took:
Call a startLeScan() which gives the BluetoothDevice as a scanResult.
Call the connectGatt() method, and the device is connected and in the onConnectionStateChange() callback, get a handle to the BluetoothGatt.
Call the discoverServices.
After that, the onServicesDiscovered() callback is hit as expected with status = GATT_SUCCESS.
However gatt.getServices returns an empty list when running on Chromebook. When running on Android device (API 19 to API23) I get BluetoothGattService handles to all the services supported by my BLE device.
Which leads me to suspect the BLE implementation on ARC on Chromebook.
Has anybody else faced this issue? Is anyone using Android BLE APIs on Chrome OS?
I've having the same trouble, and it appears to be a deficiency with the BLE implementation on Chromebooks. Although there isn't a fix or workaround, the issue is being tracked at https://bugs.chromium.org/p/chromium/issues/detail?id=722987
I have a Nexus Player on my network.
I am updating my Android App to use Google Cast V3. I have published a receiver. When I launch my app and attempt to connect to a Cast device, I only see my Chromecast devices on the network. The Nexus Player does not show up in the dialog as an option to select.
It would appear that the Receiver in the Cast Developer Console is still only seeing the test Chromecast devices, even though the Receiver is published.
Is there further configuration, possibly in the Android Manifest, that needs to be performed to allow connecting to via Google Cast to an Android TV?
It looks like I was impatient. I didn't give the Nexus Player enough time between testing my app and the publishing completed.
I am new to Android development and I am trying to use the Android's Cast API. To start I have cloned and used the CastHelloText demo app. But there should be a cast button in the ActionBar/ToolBar which is for some reason not visible. I haven't registered any app to Cast Developer Console, I am just using the project as is, which means I am using the app id mentioned in their project. Does the chromecast device need to be powered on and plugged in and the android phone with the app be near/in front of the tv in order to make the button visible? I am a little confused as there is nothing mentioned anything like this in the documentation.
Your chromecast device should be powered on and on the same network as your phone (same wifi network on both). You do't need to be in front/near the TV as long as both devices are on the same wifi network but I presume you do want to be able to see the TV's screen to see if your app works or not, don't you?
Thank you for spending time on my question !
Wish all of you have a good day!
Question:
①Could anybody tell me if i wanna use the Google Cast SDK to do the cast,i must have a Chromecast device?
②Can i do the cast between two android devices such as Phone and Tablet with the Google Cast SDK in my App?
③What does the receiver device in the remote display part mean? A android device with the receiver app or a special device such ac Chromecast?
Could anybody tell me if i wanna use the Google Cast SDK to do the cast,i must have a Chromecast device?
You must have something that is set up to work with the Cast protocol. That includes Chromecast devices and at least some Android TV devices.
Can i do the cast between two android devices such as Phone and Tablet with the Google Cast SDK in my App?
No, at least for any phones and tablets that I am aware of.
What does the receiver device in the remote display part mean? A android device with the receiver app or a special device such ac Chromecast?
There is no "receiver app" (unless you are referring to a custom receiver as being an app). In the Cast SDK, the receiver is running on the Chromecast/Android TV device and is responsible for playing back your requested media.