FORUMS
Remove All Ads from XDA

[Android 4.1+]Proxy/GateWay for Android Auto

2,443 posts
Thanks Meter: 1,899
 
By Emil Borconi, XDA Ad-Free Recognized Developer on 6th July 2018, 06:00 PM
Post Reply Email Thread
Background
- Couple of years ago Google have launched Android Auto, but up till recently the only way to connect your device to the car/head unit was to plug in a USB cable. As of 2018 this starts to change, BUT it looks like you will need to get new hardware for this and older cars/head units won't be upgraded to support this, neither phones with older OS.

Concept
- Since many of us will like to have this wire free but not ready / willing or have the possibility to upgrade the units/cars/phones I have thought of a way to achieve this, by using a small auxiliary device, like for example a very cheap and basic Android TV stick, which can be plugged in/mounted in the car and which can fulfil the roll of a Wifi antenna for your car.

This app should allow you to transform any android powered device into a Wifi receiver for your Android Auto compatible Car/Headunit. Please do not confuse Android Auto, with Android powered headunit (usually Chinese, like MTCB, MTCD, Joying, etc).

AAGateWay Documentation.

Beta released (31.12.2018)

What is it?
AAGateWay is a super small and simple app which should allow you to use and auxiliary (slave) device to connect your existing Android Auto compatible car to your phone (master) using a hotspot created on your phone.

Extra Features
  • Compatible with OBD2AA
  • Removes 6 tap limit
  • Allow adjustment of DPI

1.0 Beta
How to use instructions:
- Download and install AAGateWay on both devices (master and slave)

Configure Master (no root required):
  • Make sure your Bluetooth is turned on before starting the configuration.
  • Open app
  • Select Master on Welcome screen
  • Make sure you do grant all permissions including modifying system settings (otherwise tethering cannot be automated)
  • Select the car's Bluetooth from the list of BT devices
  • If you want to automate the process select to enable tether
  • If your device is rooted (and it's running Android 8.0 or lower) and you want you can enable the "Start headunit server" as well, however experience says generally it's much better if you start the headunit server manually and leave it running all the time and never bother with this option.
  • If you want to change your DPI enable the option and change the value (My experience says 130 will usually look better)
  • Exit the app
  • Open Android Auto, go to About tap the "About Android Auto" header 10 times till you become a developer, then from the 3 dotted top right menu select "Start Headunit Server"
  • Go to Settings -> Connected cars in Android Auto and make sure that "Add new cars to Android Auto" is enabled
  • Exit Android Auto
  • Configure a Hotspot which you will use on your slave device.


Configure Slave for TV Sticks or any other devices without input when in the car (broken screen phone, etc) - ROOT Only:
  • Open App and on the welcome screen select Slave.
  • Grant ROOT when prompted ( This will disbale Google Play Services on the device! Tv Sticks have a problem with defaults being overwritten by Google Play Service)
  • Follow on-screen instructions
  • If you are using an MK809V/MK808B stick enable the appropriate option (you can use this for other no screen devices as well, should work)
  • In case you are using a battery power pack connected to the TV Stick as well and you want to reduce power consumption when car is not running, enable Toggle Wifi and option.
  • If you are using an MK809V also enable Toggle USB on Wifi (this will make sure that the MK809V will establish a connection with the headunit)
  • Make sure the device can connect to the Masters hotspot
  • If first connection doesn't kick in for a couple of minutes, take the stick back to the house and re-check permissions, or enable the MK809V/MK808B option and use double power source for the first connection.

Configure Slave for phones (no root should be required)
  • Open App and on the welcome screen select Slave.
  • Granting Root to the app will disable Google Play Services on the device! If you are intending to use the device for other functions as well you might consider NOT granting root.
  • Ignore all blurb about root and etc (assuming you don't have root)
  • Make sure the device can connect to the Masters hotspot.
  • With the phone being unlocked connect your Slave to the car, when prompted which app to use make sure you select AAGateWay and always. (if you granted ROOT you might never see this question!)

Wifi Address setting on slave
  • In case you want to use a car Wifi Router rather then tethering from the master, make sure that the master IP is set to static, and input the masters IP in the IP field.
  • Reverse tethering, using above logic you can set your slave to tether and master connect to it, BUT you will only be able to do this if your master runs Android Pie. This function will be further enhanced and properly build in, in future releases, currently if you wish to do this, use Tasker/Automater etc to handle logic on master (USB toggle if needed - see VAG cars below, Tethering start/stop, etc). Also you will need to make sure that the Master gets a static IP.



First connection.
  • Go to the car plug in your slave and start the car.
  • Make sure your Master device is unlocked.
  • If your slave is a phone (or a device with a screen) make sure the screen is unlocked at the first setup and when prompted you do chose AAGateWay and always!
  • If everything is correct you will see a setup screen for AA on your phone, then it should also start on the car/headunit


What to watch out for:
  • - It is highly possible that your car will initially display an error message saying to check your phone when it's safe, or phone not ready, or device not supported, etc this is normal, once the slave connects to the master this message should be gone and you should see Android Auto on the car's screen.
  • - Sometimes connection can take a bit before they are set up.
  • - On your Slave you will see 2 notifications for AAGateWay that is normal, one will stay on forever the other one will be displayed only when phone there is a connection in place
  • - There might be cases when the slave won't reconnect after the car was turned off. This will depend on Slave & Car combination, if this happens you can try to enable the Toggle USB in the slave settings but that will need root.
  • - It's generally a good idea to enable USB debugging on your slave device, in many cases it will help with establishing connection with the car.
  • - Tv Sticks can be nasty occasionally. There where cases when I needed to reinstall the app 3 times same way till it worked, the problem is caused by granting USB permissions without a user input.

VAG Cars
Maybe other cars/units as well, but VAG for sure. While most cars can be tricked to wait for the slave any amount of time after a handshake, the vag cars resets the USB after 20 seconds. To work around this, please do use a slave with ROOT and make sure you toggle both options Toggle USB and Toggle Wifi, this way when there is no power coming from the headunit the Wifi and USB will be switched off, then when you start the car, first the Wifi will be turned on and as soon as you have a connection with the master the USB will be activated so AA connection kicks in.


Know problems:
  • - Latency & lag. This will be really down to the devices you are using. I have tested it with a MK808B Plus, it work’s ok most of the time but occasionally you will get the odd lag. I’ve also tested it with a Nexus 7 tablet, and there was no lag at all, so device does matter, as well as probably ROM.
  • - I get random disconnection. There can be 2 causes for this, one the USB connection fails between the car and the auxiliary device, or the Wifi fails between the phone and the auxiliary device. In my tests I saw a few Wifi disconnections without any reason on the MK808, but non on the Nexus. Changing the tethering option from WPA2 to Open did help with this.
  • - App is closed without error or reason. The app runs in a background process, with a minimal interaction with the foreground, some devices/OS will kill background apps. I saw this happening on Nokia and I saw this happening on OnePlus as well. Try disabling battery optimisation for AAGateWay, that might help.
  • - I just cannot get it to work… Try using a phone, that will at least give you some visual guidance. Make sure that your device connects to the phone Wifi hotspot, make sure that AA Headunit server is running on the phone (try to force stop Goolge Play Services, stop and restart the headunit server)… All fails contact me


Device compatibility:
Master:
Any phone which normally works with Android Auto

Slave:
  • - Tested and know to work (all with stock Rom): - MK809V,MK808B, OnePlus 6T, Pixel 2 XL, Nexus 7, Odroid C2, Sony X Compact, Samsung S7 Edge
  • - Tested and had problems:
    - worked for a while after a factory reset and fresh install, but then device simply does not enter in USB Accessory Mode. Might be my device, but expereince not the best at the moment
    - ZenPad Z380 (Wifi disconnects after a very short time)
    - Xiaomi phones (MIUI makes a mess), probably it will work with a AOSP rom.






FAQ.
Q: Can I use this with any car and phone combination?
A: Assuming your car is already Android Auto compatible, then YES.


Q: Can I also automate the start of the Headunit server?
A: Only with a rooted phone, using the following shell command: am startservice -W com.google.android.projection.gearhead/com.google.android.projection.gearhead.companion.D eveloperHeadUnitNetworkService

Q: Can I use Wifi-Direct to connect instead of WIfi?
A: Not yet, but it will be possible.

Q: Does the traffic come out from my monthly data allowance?
A: NO, traffic between auxiliary device and phone hotspot does NOT count as internet traffic, HOWEVER if you do have other apps on the auxiliary device which download updates, etc in the background that WILL be counted as internet traffic. So I suggest double check the apps on the aux device and disable all those which aren’t needed.


Q: Will the car/head unit provide enough power?
A: It should provide at least 500mA that’s the standard USB current, while I cannot guarantee that will be enough in all cases, it should do, assuming you do turn off all unneeded services on the TV stick.

Q. What about start up time?
A. It will depend a lot on the device you are using. A low-entry TV stick boot time is about 1 minute, which can be a bit too much for an initial car setup. As mentioned earlier, these devices usually have 2 USB ports, you can for example connect the power USB port to a continues power supply in the car, in which case the boot time will be non-existent since the device is always running. If you are using a phone, the phone battery will probably hold the charge just fine for a couple of days, if you disable all apps on it and you set up a profile to go into aeroplane mode when it’s not charging. Tasker or Automate are your friends for that. If you cannot connect the TV stick to a continues power source, you might consider using a small portable power pack which powers the tv stick (should hold power for a few days) and the power pack can be charged while the car is running.

Q. Can I increase boot time for TV Sticks/Phones by removing all unrelated software.
A. Yes, actually quite a lot. Once you have your configuration ready and everything is working as expected, you can uninstall/disable all packages beside this ones:
  • package:android
  • package:com.android.apkinstaller
  • package:com.android.providers.settings
  • package:com.android.packageinstaller
  • package:com.notriddle.null_launcer (or any other launcher, but NULL launcher has no memory consumption, no app drawer no nothing, perfect for headless - see: https://github.com/notriddle/null-launcher )
  • package:com.android.inputmethod.latin
  • package:com.android.settings
  • package:uk.co.borconi.emil.aagateway
  • package:com.android.shell
  • package:com.android.systemui
Easy way to list / disable all apps will be using a computer and following commands
Code:
 adb shell pm list packages
This will list all installed packages
Code:
 adb shell pm disable xxxx
where you replace xxxx with the package name (Ex: com.android.shell )


Q. Will using Wifi 5Ghz give me better performance?
A. Well if both of your devices support it, SURE!

Q. Is the source code available?
A. Sort-of, please see: https://github.com/borconi/AAGateWay this is only for the sketch, however new version does contain code which lift restrictions on 3rd party apps in Android Auto. To prevent the abuse of this by some, further code won't be updated to GitHub, however if you want to build your own version, please do contact me for details.


Guarantee or Warranty
- Due to the fact that there are so many possibilities and combinations of cars, head units, slave and master devices, there is no way for me to test all of them, however if you did purchase the software and you are not able to get it to work for any reason, please email me on [email protected] and I'm more then happy to refund the purchase.

Old Documentation

How to install it?
  1. Download XDA Labs
  2. Install the app from https://labs.xda-developers.com/stor...emil.aagateway
  3. Google play version will be available once app is in stable state.

How to set up?
Option A – Using a TV stick or any other non-screen device with ROOT as slave device.
  1. Install and open the app, grant ROOT permission, once the app notifies you that it’s all set and done, reboot your device (important bit to reboot)
  2. See common bit

Option B – Using a TV stick or any other non-screen device without ROOT as slave device.
  1. Install the app
  2. Most TV sticks will have 2 micro USB ports one for power and one for OTG. Take your laptop or portable powerpack and power up the TV stick using the power micro usb port. Go out to the car, and without disconnecting it from the power source connect it to the car as well using the OTG port. Now wait for a few seconds, then disconnect the OTG cable, but make sure the device does is still connected to a power source, go back in the house and reconnect your device to a HDMI screen for viewing. Using a mouse or any other input device, make sure you select AAGateWay from the visible prompt.
  3. See common bit

Option C – Using a phone or any other device where input is available at all times as slave device.
  1. Install the app (don’t even open it!)
  2. Plug the phone into the car, when prompted make sure you select AAGateWay and always.

Common bit:
  1. Turn on USB debugging on your device (this is not mandatory but it can help entering Android Auto mode on some no-name devices)
  2. On the phone create a Wifi hotspot
  3. Make sure your auxiliary (slave) device connects to the phones (master) Wifi.
  4. Your setup is now complete, proceed to connection.

Connection:
As soon as the car tries to establish a connection with the auxiliary (slave) device (this is connected tot the car using the USB) the app will try to connect to the headunit server on the master phone using the Wifi, in order to be able to do this, you phone needs to:
  1. Create a Wifi hotspot (on your master phone)
  2. Make sure Android Auto headunit server is running - on the master phone - (this can be started once when the phone powers up and left running, if the icon bothers you, you can hide the icon). To start the headunit server you will need to:
    • a) Open Android Auto on the (master) phone
    • b) Go to About menu
    • c) If you haven’t done this till now tap the “About Android Auto” header 10 times, till you see a message about being a developer. (This step has to be done only once)
    • d) From the 3 dotted right top corner select Start Headunit Server
    • e) Close Android Auto.
    • When this conditions are met the app will be able to connect to Android Auto using the Wifi connection.
    • Now simply plug in the auxiliary (slave) device to your car, in case you are using a TV stick make sure you connect it using the OTG connection on the stick.


How to produce bug report?


1. Enabling Developer Mode
  1. Open Settings > About phone.
  2. Scroll down to the Build number.
  3. Tap the Build number 7 times in quick succession until "You're now a developer" appears.
  4. Return to the Settings menu and select Developer options.
  5. At the top of the screen, make sure 'Developer options' is set to On (green).
  6. Scroll down to Debugging and enable both USB debugging and Bug Report Shortcut on (green).
  7. Tab on Logger buffer sizes: Default setting is 256K. Select 16M to help capture more information for debugging. Of note, it can affect the apps performance especially with lower spec phone, so change it back after you have finished submitting bug reports.

32 Capturing a Bug Report
It's very important to do this right after you experience the issue again, so your device can log at least one occurrence of the issue.
  1. Hold the Power button down until the menu appears.
  2. Select Take bug report. and wait for the device to capture the bug report.
  3. Tap the 'Bug report captured' notification when it appears.
  4. Share the bug report. (I recommend to email it to yourself.)
  5. Download the bug report to your computer.
  6. Send the bug report by email to [email protected]


Teaser:
[YOUTUBE]tc0gpgMBuLo[/YOUTUBE]
The Following 89 Users Say Thank You to Emil Borconi For This Useful Post: [ View ]
 
 
6th July 2018, 08:28 PM |#2  
Member
Thanks Meter: 28
 
More
VERY interested in the progress on this, Emil. For one, this would allow me to charge my Samsung using the Quick Charge adapter in my cigarette lighter, rather than relying on the anemic power output of my truck's USB port. Or if I want to get fancy, I could install a wireless charger and use that.

Thanks for all of your hard work.

Sent from my SM-G935V using Tapatalk
The Following 5 Users Say Thank You to SLAB_8002 For This Useful Post: [ View ] Gift SLAB_8002 Ad-Free
6th July 2018, 09:01 PM |#3  
Jackos's Avatar
Inactive Recognized Developer
Flag Warsaw
Thanks Meter: 945
 
More
Hi Emil,
What about original headunits that have integrated Wifi, but do not have Wireless Android Auto enabled? Is this something that you could enable to work as well?
The Following 3 Users Say Thank You to Jackos For This Useful Post: [ View ] Gift Jackos Ad-Free
6th July 2018, 09:59 PM |#4  
Member
Thanks Meter: 13
 
More
Another great idea.
Definitely interested..
thanks.



Sent from my iPad using Tapatalk
The Following User Says Thank You to jeromeo01 For This Useful Post: [ View ] Gift jeromeo01 Ad-Free
6th July 2018, 10:21 PM |#5  
moralesnery's Avatar
Senior Member
Thanks Meter: 340
 
More
I thought of you instantly when I saw this thread on Reddit, but didn't imagine that you were the creator.
Congratulations and thanks again!
The Following User Says Thank You to moralesnery For This Useful Post: [ View ] Gift moralesnery Ad-Free
6th July 2018, 11:20 PM |#6  
OP Recognized Developer
Flag Wakefield
Thanks Meter: 1,899
 
Donate to Me
More
Quote:
Originally Posted by Jackos

Hi Emil,
What about original headunits that have integrated Wifi, but do not have Wireless Android Auto enabled? Is this something that you could enable to work as well?

Sadly no, that will require altering the firmware on the car and each unit is different. It is possible that those unit might get an official update for Wifi support, but although I'm not 100% certain, I think it will only work with 5Ghz Wifi network, so if you're unit is 2.4Ghz only probably it won't get the update.


If I will ever have times (something which I never have ) I might look into adding this to some units out there, but that is so far down the line, that realistically speaking probably will never happen.
The Following User Says Thank You to Emil Borconi For This Useful Post: [ View ]
7th July 2018, 10:23 AM |#7  
Senior Member
Thanks Meter: 250
 
More
Very interesting idea. I have a couple of these android sticks here and maybe even a modern mediabox that might offfer a bit more performance. I guess you want to power it from the USB socket from the car. Not sure how much current you can draw from these ports.
What is the pc below the radio doing?
7th July 2018, 10:58 AM |#8  
Senior Member
Flag Melbourne
Thanks Meter: 35
 
Donate to Me
More
This is awesome news! looking forward to progress!
7th July 2018, 03:03 PM |#9  
OP Recognized Developer
Flag Wakefield
Thanks Meter: 1,899
 
Donate to Me
More
Quote:
Originally Posted by lukesan

Very interesting idea. I have a couple of these android sticks here and maybe even a modern mediabox that might offfer a bit more performance. I guess you want to power it from the USB socket from the car. Not sure how much current you can draw from these ports.
What is the pc below the radio doing?

Performance is not really needed the slowest device should work just fine. You can theoretically disable all processes and apps, so even a device with 512Mb ram will do.
Indeed I'm taking power directly from the headunit/car in the demo I use an MK808B powered directly from the Sony XAV-100 which only provides like 500mA, so should do (especially if you kill all apps which can use CPU and turn of everything but Wifi on the stick).

The PC is the power source , to lazy to make a separate power switch so I powered the Sony from my PSU directly
The Following 2 Users Say Thank You to Emil Borconi For This Useful Post: [ View ]
7th July 2018, 03:22 PM |#10  
Senior Member
Thanks Meter: 250
 
More
Quote:
Originally Posted by Emil Borconi

Performance is not really needed the slowest device should work just fine. You can theoretically disable all processes and apps, so even a device with 512Mb ram will do.
Indeed I'm taking power directly from the headunit/car in the demo I use an MK808B powered directly from the Sony XAV-100 which only provides like 500mA, so should do (especially if you kill all apps which can use CPU and turn of everything but Wifi on the stick).

The PC is the power source , to lazy to make a separate power switch so I powered the Sony from my PSU directly


Ok, got the Mk802, 808 etc etc so I might finally have a good destination for those. Lazy and working is a combo that also works.
Wondering if there is like a beta test thing, or is it complex to get it up and running? I'm pretty sure a lot of people are seriously interested in this. It would offer the freedom of charging your phone the proper way.
7th July 2018, 03:39 PM |#11  
OP Recognized Developer
Flag Wakefield
Thanks Meter: 1,899
 
Donate to Me
More
Quote:
Originally Posted by lukesan

Ok, got the Mk802, 808 etc etc so I might finally have a good destination for those. Lazy and working is a combo that also works.
Wondering if there is like a beta test thing, or is it complex to get it up and running? I'm pretty sure a lot of people are seriously interested in this. It would offer the freedom of charging your phone the proper way.

Not that far away, the only problem this will be braking my fix for obd2aa, so I need to make the 2 things compatible. I also need to do find a way to set the defaults without plugging into the car, you won't really be able to plug in a HDMI screen when you plug it in the car.

I've started fully rewriting my HUR app moving all the code from C to Java, once that is done and I fix other issues with obd2aa I will be pushing this forward

Ideally I will like to have a release available before I go on holiday on the 17th of July but not sure I will manage to do it all by that time.
The Following 4 Users Say Thank You to Emil Borconi For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
android auto wifi

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

Advanced Search
Display Modes