App Radio Forums » AppRadio 2 » Android v » Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs Welcome back, Guest. Please Login or Register.



Post Reply 
Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
02-17-2014, 03:13 PM
Post: #1
Photo Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
I was bugged by the fact that we now know how to automate the Wireless Display connection using the allsharecast framework on TW ROMs, but that there was no way to do that on AOSP ROMs. I have a Galaxy S4 mini (international version) running Cyanogenmod 10.2.1 and there is no action, that you can call from tasker / secure settings, that makes your device connect automatically.

So, i rummaged out my old C and Java skills and modified my Settings package so that it would autoconnect to the first available display it finds (still very crude, I know). To my big surprise, that really worked! I am now using the following setup:

- Appradio 2 SPH-DA100
- Samsung Galaxy S4 mini (CM 10.2.1, Android 4.3.1)
- Belkin Miracast to HDMI Adapter
- Tasker with secure settings plugin

The Miracast Adapter gets power when I unlock my car, so it has enough time to boot and is ready when I turn on the ignition and the appradio starts up.
I have made a profile in tasker that is triggered by the bluetooth connection, which comes up automatically when Appradio has started. That profile then removes my pattern lock, turns on my display, modifies volumes and calls the WFD Settings action of my modified Settings.apk using the secure settings plugin. The WFD Settings action will then connect to the first Miracast adapter it finds.
So i do not have to touch my phone or remove it from my pocket (except if I want to hook it up to get power), all connections are fully automated and terminated likewise. Also, this is the only working configuration I know that will connect a Samsung Galaxy S4 mini with AOSP based ROM to Appradio (since the MHL drivers are only in TW based ROMs and cannot be extraced).

I will modify the Settings.apk further to get some more configuration features like enabling and disabling autoconnect, and maybe configure that on a per remembered device basis. I am writing this because I would like to know if there are any other troubled Appradio/Miracast/AOSP users out there. If so, I would be happy to share my modified Settings and try to support as many configurations as I can :-)
There is a chance it will also work on other devices running AOSP based ROMs with 4.3.1. This will not work on Samsung TW based ROMs, for that you need to use the trick in this thread:
http://appradioforums.com/Thread-Automat...tion-Found
Find all posts by this user
Quote this message in a reply
02-17-2014, 07:33 PM
Post: #2
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
Curious how you wired the adapter to get power when you unlock the car. Are you tapping into a relay of some type?
Find all posts by this user
Quote this message in a reply
02-18-2014, 05:55 AM
Post: #3
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
(02-17-2014 07:33 PM)Design Wrote:  Curious how you wired the adapter to get power when you unlock the car. Are you tapping into a relay of some type?

It's a BMW E46, they all have cables in the glovebox that - if that option was chosen - charge a flashlight of some kind which then has a dock in the glovebox. Mine does not have that option, but even without it, the cables and relays are always there. The flashlight is only charged when the vehicle is unlocked, so I used those cables to hook up my adapter.
Find all posts by this user
Quote this message in a reply
02-25-2014, 01:03 PM
Post: #4
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
So I'm pretty uniformed on how all of this stuff works, but I've been trying to automate the connection on my stock rooted moto x since the day I got it. Will your modified settings.apk work on stock android? If so would you mind sharing it?
Find all posts by this user
Quote this message in a reply
02-25-2014, 01:11 PM
Post: #5
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
(02-25-2014 01:03 PM)Chobo Wrote:  So I'm pretty uniformed on how all of this stuff works, but I've been trying to automate the connection on my stock rooted moto x since the day I got it. Will your modified settings.apk work on stock android? If so would you mind sharing it?

Not out of the box. But you might already have that functionality, some Motorola phones do have an autoconnect feature like this
[Image: wireless-display-4.PNG]

I basically just recreated that feature for AOSP ROMs. Do you have that option on your phone?
Find all posts by this user
Quote this message in a reply
02-25-2014, 01:59 PM
Post: #6
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
The option is there, but it doesn't work they way one might think. Basically, it will only auto connect if the WiDi receiver is present when the phones WiDi capability is turned on. If the phone has WiDi on and before I into my car and the receiver turns on, it won't automatically connect because the receiver wasn't present when the phones capability was turned on.

My work around has been to manually turn on the WiDi when I get into the car. I would like to come up with a way to automate that turning on process with tasker.

In other words what I need is a way to have the phone toggle that on/off slider at the top of the screen you posted. Does your modified APK have that ability?
Find all posts by this user
Quote this message in a reply
02-25-2014, 02:07 PM
Post: #7
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
(02-25-2014 01:59 PM)Chobo Wrote:  The option is there, but it doesn't work they way one might think. Basically, it will only auto connect if the WiDi receiver is present when the phones WiDi capability is turned on. If the phone has WiDi on and before I into my car and the receiver turns on, it won't automatically connect because the receiver wasn't present when the phones capability was turned on.

My work around has been to manually turn on the WiDi when I get into the car. I would like to come up with a way to automate that turning on process with tasker.

In other words what I need is a way to have the phone toggle that on/off slider at the top of the screen you posted. Does your modified APK have that ability?

Yes, in my settings.apk, when the main action of the WFD settings is called, the search is triggered. Currently, it will automatically connect to the first display that is identified as available. I have to Trigger the search by sending the appropriate intent with tasker and secure settings which will then start the main action which will trigger the search when called. Your WFD settings should autoconnect when a search run identifies a remembered and available display. Is that not the case on your phone?
Find all posts by this user
Quote this message in a reply
02-25-2014, 02:13 PM
Post: #8
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
It doesn't seem to be. I just tested it again to make sure I'm not crazy. I enabled WiDi on my phone while the car was still off and made sure it was set to auto connect last device. Once it was on and idle I turned on the car and the WiDi receiver hooked up to the radio. I see the reciever show up on the list of available devices, but it never connects. I waited a couple of minutes to make sure that it wasn't just going slowly.

I then toggled the WiDi setting off then back on with the phone, and as soon as it starts back up it auto connects to my receiver.

What is the intent that you call with tasker? I wasn't able to find one that gave me the ability to turn WiDi on/off, but maybe re-triggering the search your way will work. Or is that intent the part of the APK you modified?
Find all posts by this user
Quote this message in a reply
02-25-2014, 02:24 PM
Post: #9
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
(02-25-2014 02:13 PM)Chobo Wrote:  It doesn't seem to be. I just tested it again to make sure I'm not crazy. I enabled WiDi on my phone while the car was still off and made sure it was set to auto connect last device. Once it was on and idle I turned on the car and the WiDi receiver hooked up to the radio. I see the reciever show up on the list of available devices, but it never connects. I waited a couple of minutes to make sure that it wasn't just going slowly.

I then toggled the WiDi setting off then back on with the phone, and as soon as it starts back up it auto connects to my receiver.

What is the intent that you call with tasker? I wasn't able to find one that gave me the ability to turn WiDi on/off, but maybe re-triggering the search your way will work. Or is that intent the part of the APK you modified?

Yes, you have to trigger the search, because your phone can only autoconnect to devices after identifying them as available during a search. It will not search by itself, that is why you have waited in vain so far. To trigger the search you can:

- Toggle WiDi On/Off (which you already did)
- Press search button when WiDi is On
- Send intent to start main WFD activity

If you want to do the latter, you have to install the secure settings plugin for tasker (search for secure settings in Play Store) and then use the "Launch Activity" function in Tasker/Secure Settings. Choose the settings app and select the one activity that begins with "Wireless Display (WiDi)". That should trigger the search.
Find all posts by this user
Quote this message in a reply
02-25-2014, 02:39 PM
Post: #10
RE: Automating Wireless Display / Miracast connection to HDMI Adapter on AOSP ROMs
Unfortunatly there are no "Wireless Display (WiDi)" activities in available when I look at the settings app with secure settings. Not sure why it wouldn't be there on my phone, any idea why that might be?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)