FORUMS
Remove All Ads from XDA

[Android 4.1+]Proxy/GateWay for Android Auto

2,987 posts
Thanks Meter: 2,403
 
By Emil Borconi, XDA Ad-Free Recognized Developer on 6th July 2018, 07:00 PM
Post Reply Email Thread
14th January 2020, 10:43 PM |#1971  
OP Recognized Developer
Flag Tg. Secuiesc / Kezdivasarhely
Thanks Meter: 2,403
 
Donate to Me
More
Quote:
Originally Posted by Marshy33

Hi Emil,

I'm trying to set up a macrodroid task to gain the HUR hotspot gateway IP (as it changes on each new hotspot created) to then be able to use this in the tasker profile shared earlier.

Do you a a shell script to be able to get this?

I have found the following, but this returns the gateway of my mobile network as the WiFi isn't connected to the internet.

ip route get 8.8.8.8 | tr -d '\n' | awk '{print $3}'

Thanks

Actually this might be exactly what you need:

https://tasker.joaoapps.com/userguide/en/java.html

There is an example on how to get the wifimanager, but instead of calling the iswifienabled() function you should use getDhcpInfo()
That returns an object and the objects gateway prompt is the ip
14th January 2020, 10:48 PM |#1972  
Junior Member
Thanks Meter: 6
 
More
Hi Emil,
The AAGateWay app crashes (or exits) a few times per day. Is there a shortcut or intent I can send from Tasker to make sure the service is running? Simply launching the app doesn't start the service.
I already checked the battery optimization, which doesn't seem to be the problem.
Thanks!
14th January 2020, 11:21 PM |#1973  
Member
Thanks Meter: 11
 
More
Quote:
Originally Posted by Emil Borconi

Actually this might be exactly what you need:

https://tasker.joaoapps.com/userguide/en/java.html

There is an example on how to get the wifimanager, but instead of calling the iswifienabled() function you should use getDhcpInfo()
That returns an object and the objects gateway prompt is the ip

Thanks I'll have a look at this tomorrow.

I have managed to get it using...

ip route list match 0 table all scope global | awk 'NR==1{print $3}'

But that depends on the wlan0 always being the top row which Im not sure it always will be.

This is all new to me lol.

Sent from my MI 8 using Tapatalk
15th January 2020, 03:51 AM |#1974  
Senior Member
Flag Vancouver
Thanks Meter: 58
 
More
You can add me to the list of those getting it working sort of under Case 3. I only tested it for a few minutes and likely won't get a chance to follow up for a couple of days, but definitely promising.
  1. Slave: rooted Moto Z running LineageOS 15.1 (Oreo) with nano GApps
  2. Slave running the latest AA Gateway beta in "root" mode but not as a system app
  3. Master: Samsung Note 10
  4. Car: 2018 Audi RS3

Opened hotspot and AA Head Unit Server on my master using a one-touch Tasker app (basically a Tasker task exported to an .apk by Tasker App Factory). I did not rely on WiFi launcher. The slave connected to my Note's hotspot. I then got in the vehicle and connected the slave via USB to my car. I did not get an AA Gateway splash screen, rather I got a prompt to activate Android Auto on my nav screen. Did so and had full Android Auto working flawlessly, but I only tested it for about 5 minutes. When I looked at paired devices on my Audi, it used to list the Gateway as an Android Auto unit. Now it lists my Note 10 twice (once for the direct USB connection and once for the wireless).

Definitely promising!
15th January 2020, 08:15 AM |#1975  
Member
Thanks Meter: 18
 
More
@Emil Borconi
I have tried using the task written by ggilliland without any success.
I have created a profile in tasker which runs the task when the master is connected to the hotspot but if I have mobile data on the master switched on, it works a couple of times then stops working. Only if the mobile data is switched off does the tasker profile work reliably. This is not an obstacle to testing the task but obviously I would need to switch on mobile data once I had an AA connection because it would be then needed, but not before.
I would like to use the slave phone either with no simcard or with mobile data off as it is only a prepaid card and I don't want to pay for using any mobile data. With no simcard in the slave I cannot manually turn on the hotspot but AAGateway can.
With the master phone with mobile data switched off, when it is connected to the slave phone hotspot and I look in the settings of the slave phone it says 'ip address not available' and when I look in settings of master phone it says it has an ip address of 192.168.43.165 .
In the tasker task I have to input an ip address, what should I input? The only ip address that I have is the address of the master, as above, but nothing happens when I use this ip address.
Is it possible to give the slave phone an artificial ip address which I could use?
15th January 2020, 08:47 AM |#1976  
OP Recognized Developer
Flag Tg. Secuiesc / Kezdivasarhely
Thanks Meter: 2,403
 
Donate to Me
More
Quote:
Originally Posted by naqand

Hi Emil,
The AAGateWay app crashes (or exits) a few times per day. Is there a shortcut or intent I can send from Tasker to make sure the service is running? Simply launching the app doesn't start the service.
I already checked the battery optimization, which doesn't seem to be the problem.
Thanks!

There is a big difference between crash and exit No I don't have anything added to it, tell me what you will like exactly.
I think what you are experiencing is that the OS kills the background listener service... since it's not doing anything just sitting their and waits for an intent to be broadcasted...
15th January 2020, 08:51 AM |#1977  
OP Recognized Developer
Flag Tg. Secuiesc / Kezdivasarhely
Thanks Meter: 2,403
 
Donate to Me
More
Quote:
Originally Posted by martin.armstrong

@Emil Borconi
I have tried using the task written by ggilliland without any success.
I have created a profile in tasker which runs the task when the master is connected to the hotspot but if I have mobile data on the master switched on, it works a couple of times then stops working. Only if the mobile data is switched off does the tasker profile work reliably. This is not an obstacle to testing the task but obviously I would need to switch on mobile data once I had an AA connection because it would be then needed, but not before.
I would like to use the slave phone either with no simcard or with mobile data off as it is only a prepaid card and I don't want to pay for using any mobile data. With no simcard in the slave I cannot manually turn on the hotspot but AAGateway can.
With the master phone with mobile data switched off, when it is connected to the slave phone hotspot and I look in the settings of the slave phone it says 'ip address not available' and when I look in settings of master phone it says it has an ip address of 192.168.43.165 .
In the tasker task I have to input an ip address, what should I input? The only ip address that I have is the address of the master, as above, but nothing happens when I use this ip address.
Is it possible to give the slave phone an artificial ip address which I could use?

Sadly not quite as I will need to modify the tether part of the os, even now automating tethering is not guaranteed to work...
The reason you're script is failing it's because there is no guarantee it will use the Wifi network when it tries to open the IP/COMMAND. I don't think or better said I'm not sure you can force this in tasker. In Java inside the Wifi Launcher for HUR app I can tell the app to only use the Wifi network for this...
15th January 2020, 08:53 AM |#1978  
OP Recognized Developer
Flag Tg. Secuiesc / Kezdivasarhely
Thanks Meter: 2,403
 
Donate to Me
More
Quote:
Originally Posted by JohnnyCanuck

You can add me to the list of those getting it working sort of under Case 3. I only tested it for a few minutes and likely won't get a chance to follow up for a couple of days, but definitely promising.

  1. Slave: rooted Moto Z running LineageOS 15.1 (Oreo) with nano GApps
  2. Slave running the latest AA Gateway beta in "root" mode but not as a system app
  3. Master: Samsung Note 10
  4. Car: 2018 Audi RS3

Opened hotspot and AA Head Unit Server on my master using a one-touch Tasker app (basically a Tasker task exported to an .apk by Tasker App Factory). I did not rely on WiFi launcher. The slave connected to my Note's hotspot. I then got in the vehicle and connected the slave via USB to my car. I did not get an AA Gateway splash screen, rather I got a prompt to activate Android Auto on my nav screen. Did so and had full Android Auto working flawlessly, but I only tested it for about 5 minutes. When I looked at paired devices on my Audi, it used to list the Gateway as an Android Auto unit. Now it lists my Note 10 twice (once for the direct USB connection and once for the wireless).

Definitely promising!

Any reason why you haven't used/tried case 1 or 2 with Wifi Launcher for HUR on the phone?
15th January 2020, 10:07 AM |#1979  
Junior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by Emil Borconi

There is a big difference between crash and exit No I don't have anything added to it, tell me what you will like exactly.
I think what you are experiencing is that the OS kills the background listener service... since it's not doing anything just sitting their and waits for an intent to be broadcasted...

I may have missed the battery optimization thing after numerous reinstallations of aagateway... Oops!
Anyway, an android shortcut for just starting the aagateway service without opening the gui would be awesome! It allows for monitoring by Tasker and starting the service if necessary without user interaction or display unlock.

---------- Post added at 10:07 AM ---------- Previous post was at 10:04 AM ----------

Quote:
Originally Posted by Emil Borconi

Any reason why you haven't used/tried case 1 or 2 with Wifi Launcher for HUR on the phone?

Probably for the same reason as me... The master loses mobile data when connecting to the slave's hotspot.
I read something about wifi direct though, which sounds like the best solution for this. Only I couldn't find information on how to set it up for aagateway. Could it work? If yes, how?
15th January 2020, 10:24 AM |#1980  
Member
Thanks Meter: 11
 
More
Managed to get it working this morning using a macrodroid process on the master which reads the HUR IP gateway and then uses this in another action that was shared for tasker previously to launch android auto.

On my 20 min drive to work, Spotify cut out several times, and would only start playing again if I selected a different app on AA on the headunit. As soon as I pressed the other app icon the music would start again.

Will try again later using HUR app and see if still get the audio issues.


Sent from my MI 8 using Tapatalk
The Following User Says Thank You to Marshy33 For This Useful Post: [ View ] Gift Marshy33 Ad-Free
15th January 2020, 11:02 AM |#1981  
OP Recognized Developer
Flag Tg. Secuiesc / Kezdivasarhely
Thanks Meter: 2,403
 
Donate to Me
More
Quote:
Originally Posted by naqand

I may have missed the battery optimization thing after numerous reinstallations of aagateway... Oops!
Anyway, an android shortcut for just starting the aagateway service without opening the gui would be awesome! It allows for monitoring by Tasker and starting the service if necessary without user interaction or display unlock.

---------- Post added at 10:07 AM ---------- Previous post was at 10:04 AM ----------


Probably for the same reason as me... The master loses mobile data when connecting to the slave's hotspot.
I read something about wifi direct though, which sounds like the best solution for this. Only I couldn't find information on how to set it up for aagateway. Could it work? If yes, how?

The problem is that if you're master is not connected to a Wifi you can't use the method build into AA to start the projection service as that will check if the phone is connected to a Wifi, so Wifi DIrect won't work, which means you will need to have the headunit server running. The problem with the headunit server is that it can get stuck and that means you need to reboot the phone, hence connecting master to slave hotspot is preferred. Normally if you open Settings -> Wifi -> Wifi Preferences there should be an option to "Auto switch to mobile data" which will make sure that the phone keeps using mobile data even when you are connected to a Wifi. This option is only available starting with Android Pie though.
The Following User Says 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