HDMI-CEC and the Chromecast - android

I know that the Chromecast is being launched automatically with any app that has the "Cast" icon. That means we can be using directly a phone or tablet without the TV controller to initiate a connection.
HDMI-CEC has something to do with this.
TV switches automatically.
What I would like to know is if it would be possible to end the connection with the Chromecast and not land on the Chromecast homepage like right now. I would like to come back on the signal that I had before the "Cast", which could be a channel of the TV for example, and this, without the TV controller.
Currently, it is impossible to come back without not using the "Source" button of the TV controller.
Does anyone have a solution that could help me?

So, in CEC there is a provision to tell the TV you're done. It's called <Inactive Source>.
Chromecast uses <Active Source> to turn on the TV and change inputs it it.
It could use <Inactive Source> to indicate to the TV that it has stopped sending video.
<Inactive Source>, however, varies by TV.

Related

How to know when input TV changed from HDMI1 to HDMI2 programmatically?

I am developing an app for "GoogleTV" and "Chromecase with GoogleTV". My app needs to know when HDMI input changed to pause the video stream. I have found the following information about it for FireTV:
https://developer.amazon.com/docs/fire-tv/handling-hdmi-events.html#available-apis
I tried the same implementation for GoogleTV running in Chromecast. The problem is that any intent is received by the listener when input TV changes from HDMI1 to HDMI2 (or broadcast TV input). Events are received only when TV is turned ON/OFF.
Is there any way to know when the TV input changes in Chromecast?

Android, Bluetooth, catching special commands from BT device

How can we listen for special BT device commands like redial from our app? For now, I'm only able to listen to the only one - play/pause/start/end call button (KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE).
Using common BroadcastReceiver for "android.intent.action.MEDIA_BUTTON" doesn't help.
Solution with BluetoothSocket, BluetoothServerSocket won't help too since it requires our code to be invoked on BT device side.
During my redial button tests I see the next line in the logs:
01-20 05:52:30.486 942-1060/com.android.bluetooth E/bt-rfcomm: PORT_DataInd, p_port:0x5526c200, p_data_co_callback is null
It looks like there is something sending an event from BT device to the android device. But how can we catch it on app side, what should we use? I work on some system app by the way and theoretically can do very specific, low-level and system things, so maybe there could be some solution.
afaik, this isn't possible, sadly...
I've been working on custom handling BT headset keys, like VOL UP, DOWN, eventually ANSWER/DISCONNECT/REDIAL. Even made rich question, but without single answer or comment...
After some research (days, weeks...) and digging into Android source I've found that these buttons are sending some AT commands. I've also found methods which are checking these AT commands and if system is able to respond/handle them then it TRY to do it and further won't pass any event to any app/socket/rfcomm/anything... E.g. under VOL UP button we have some well-known AT command, system can handle it, so try to do so, even when we already have volume set to max. Any app won't be noticed that this happened...
btw. I don't think this logcat line posted in question is strictly relevant to button press (but may be indirectly), but you have bt-rfcomm keyword in there, so you may try to establish some RFCOMM connection with Bluetooth device, maybe you will get some luck on this topic... (personally I gave up...)

How to get MediaRouteSelector to show available MiraCast and Chromecast devices?

I am trying to get my Media Route Selector to show both MiraCast and Chromecast devices. I have a Chromecast receiver app and also make use of the Presentation API in Android so ideally the user should only have to click the media router button and chose the device they have without even having to think about it. I was following this guide (https://developer.android.com/guide/topics/media/mediarouter.html#selector) to achieve this and in the picture it shows both a Chromecast and wireless display available in the route selector. However, after adding the control categories I still only see the Chromecast.
Here is the relevant code.
mMediaRouteSelector = new MediaRouteSelector.Builder()
.addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
.addControlCategory(CastMediaControlIntent.categoryForCast(CAST_APP_ID))
.build();
...
mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
I have tried changing the callback flag also but saw no change.
EDIT:
I ended up creating a custom dialog factory for the router button and using a separate layout that includes a button that will send the user to wireless display settings. Not exactly the solution I was looking for but it appears that what I was actually trying to do is not supported.

Android Bluetooth SCO with Nissan car radio

Before we get to the details, a little context:
Car: Nissan Note (UK 2011 Model)
Device: Nexus 4
OS: Android 4.3 Stock
I'm trying to create an app to do speech recognition and synthesis in my car while the phone is connected over bluetooth. The car audio system does not provide it's own voice recognition, but instead delegates this to the phone by triggering an intent android.intent.action.VOICE_COMMAND
The default app on the device for handling this is the Google Search app, which has a specific activity for hands-free dialling. This app has terrible speech recognition but does demonstrate how the system is supposed to work - when activated the car displays "Voice recognition active" on the phone screen while the app is running, and then hides it when the app exits.
The problem I have is that while I can make this label appear by calling AudioManager.startBluetoothSco() and thus play audio through the car speakers and record it through the car microphone, but AudioManager.stopBluetoothSco() does not disable this mode in the car, and it remains displaying 'Voice recognition active'. This is a problem since the car will not then launch the app until the bluetooth connection has been closed and re-opened.
My experiments have verified that it is AudioManager.startBluetoothSco() which enables the mode in the car, and that AudioManager.stopBluetoothSco() appears to have the effect of changing the ambient sound produced by the car (a very faint hiss usually heard when the audio system is active will stop when this command is issued) but no other effect is seen.
I am unsure if something else is activated implicitly with the call to AudioManager.startBluetoothSco() which must then be implicitly stopped, but I'm currently out of ideas for what to try.
After a lot more research I came across this: http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html#stopVoiceRecognition%28android.bluetooth.BluetoothDevice%29
which would appear to be related to the problem. After calling startVoiceRecognition and stopVoiceRecognition as appropriate, things appeared to return to their normal state.

Channel Listing in Google TV not showing channels

I'm testing Googl's 'Channel Changing Example' on my Sony Google TV.
I'm connected to a DVB (Digital Video Broadcasting) through the HDMI port.
When i'm running the example the number of retrieved channels is 0.
Just to be clear, I can see the TV channels using the 'Live TV' in the TV itself.
You need to make sure that your selected device has a channel lineup. Based on the fact that you're using DVB, I'm guessing you're not in the US, which means you aren't really using this in a supported country. However, you can fake it by going to Settings > Video input > Configured devices > (whatever your TV source is) > Edit channel lineup and then go through the prompts. This will download the list of channels for your connected set top box (again, this is probably not going to be your real lineup, but enough for you to test out the sample.

Categories

Resources