Closed Mygod closed 2 weeks ago
A more compelling reason to support this would be for instant tethering. This could be done by checking wifiApConfiguration.SSID
and see if it matches ^Instant Tethering
.
Unfortunately, listening for ACTION_TETHER_STATE_CHANGED
in manifest is not quite possible since Android 8, therefore a persistent foreground service would be needed. MacroDroid only supports listening for hotspot changes, and none at all for Tasker.
EDIT: I created a thread on their forum. Go spam them until they add this.
I'm still in the same boat. When I turn my car on, my hotspot is started and to get vpn/hotspot working I have to open the app and hit the wlan switch to route the hotspot through my vpn. I was thinking about trying to automate this process with tasker by opening vpn hotspot after tasker turns the hotspot on and then have tasker use the cli to initiate a screen press over the wlan switch to turn it on. It seems like this might be worth a try since my scenario should be fairly predictable because the only thing I use the phone for is the hotspot connection. I haven't looked at macro droid yet, but I'll have to check it out
Meanwhile, I think a good workaround would be a monitoring mode for system VPN tethering. I will implement it in 2.3.0.
Bump on implementing intent interface. I can not find an app as reliable in turning on & off tethering - just by itself, w/o VPN involvement. I'd love to use it with Llama to automate getting into the car and having tethering for my car radio / off when out. (On a side note... gets me thinking AppleScript for Android should be a thing with object & class interface definition part of every app.)
Why not use the tasker plugin system? https://tasker.joaoapps.com/plugins-intro.html
Awesome app btw! -DM
it will be a very lentgthy addition to enable tasker integration.
if you want to add with short code, just add some a Broadcastreceiver to receive intent... and trigget hr e action in the source code... Now from the Tasker send the Intent directly.
if you make a tasker plugin... you need to read whole documentation of tasker plugin making.
If i have free time i might add this tasker facility
Has anyone figured out a good way to automatically toggle the rndis0 tunnel? I'm using a phone to act as a usb modem for a router. I've managed to automate turning on the usb hotspot and VPN. The missing piece would be to automatically turn on rndis0 whenever usb tethering is reset.
+1 for Tasker integration. I also think making the app compatible with the AutoInput accessibility service would be another good place to start. It should be simpler than writing a new plugin. AutoInput currently can not interact with the VPN Hotspot UI, but if it could, manually toggling the switches as @sea3pea0 and @sollermun describe wouldn't be an issue.
I recently noticed that VPN Hotspot was able to toggle Bluetooth Tethering off and on without being systemized on android 13.
This interested me greatly, since all the other tools I used to use to toggle BT Tethering off and on refused to work on Android 13, even when systemized.
I've never done Android development before, but I sat down with Android Studio and copy & pasted the Tile Handler into a Broadcast Handler which can receive intents from MacroDroid or Tasker.
Here is what the changes look like if anyone wants to build a copy for themselves (or add more intents to support more automation): https://github.com/Swap-File/VPNHotspot/commit/a4024d2a2306aa3d3842d29ec513b8d9358179dc
I'm not sure if there is a limit to how many intents you can add to the manifest, but two work fine for me.
Here's what the intent looks like inside of Macrodroid:
I recently noticed that VPN Hotspot was able to toggle Bluetooth Tethering off and on without being systemized on android 13.
This interested me greatly, since all the other tools I used to use to toggle BT Tethering off and on refused to work on Android 13, even when systemized.
I've never done Android development before, but I sat down with Android Studio and copy & pasted the Tile Handler into a Broadcast Handler which can receive intents from MacroDroid or Tasker.
Here is what the changes look like if anyone wants to build a copy for themselves (or add more intents to support more automation): Swap-File@a4024d2
I'm not sure if there is a limit to how many intents you can add to the manifest, but two work fine for me.
Here's what the intent looks like inside of Macrodroid: ...
Hello! Thanks so much for this information. With your (and an LLM's help) I was able to build and test this in a couple of hours, and it works great. And obviously thanks to the original app developer/s too! :-D
Hi there,
I was really interested in this thread, as my goal was to automate bringing up a wireguard vpn interface and programmatically starting the hotspot via tasker. To do this, I needed to both add the broadcastreceiver to receive the intent to start tethering, as described above, and also have the program automatically monitor all new interfaces that were added. I made these modifications and published them in a modified source code here:
https://github.com/hansonxyz/vpnhotspotmod
The key extra changes to the code Swap-File added was changing the TetheringService from START_NOT_STICKY to START_STICKY, and adding the following code around line 565 on TetheringManager.kt:
method.matches1<java.util.List<*>>("onTetheredInterfacesChanged") -> {
@Suppress("UNCHECKED_CAST")
val tetheredInterfaces = args!![0] as List<String?>
callback?.onTetheredInterfacesChanged(tetheredInterfaces)
// hansonxyz
tetheredInterfaces?.let {
for (iface in it) {
App.app.startForegroundService(
Intent(App.app, TetheringService::class.java)
.putExtra(
TetheringService.EXTRA_ADD_INTERFACES,
arrayOf(iface)
)
)
}
}
}
Hi there,
I was really interested in this thread, as my goal was to automate bringing up a wireguard vpn interface and programmatically starting the hotspot via tasker. To do this, I needed to both add the broadcastreceiver to receive the intent to start tethering, as described above, and also have the program automatically monitor all new interfaces that were added. I made these modifications and published them in a modified source code here:
https://github.com/hansonxyz/vpnhotspotmod
The key extra changes to the code Swap-File added was changing the TetheringService from START_NOT_STICKY to START_STICKY, and adding the following code around line 565 on TetheringManager.kt:
method.matches1<java.util.List<*>>("onTetheredInterfacesChanged") -> { @Suppress("UNCHECKED_CAST") val tetheredInterfaces = args!![0] as List<String?> callback?.onTetheredInterfacesChanged(tetheredInterfaces) // hansonxyz tetheredInterfaces?.let { for (iface in it) { App.app.startForegroundService( Intent(App.app, TetheringService::class.java) .putExtra( TetheringService.EXTRA_ADD_INTERFACES, arrayOf(iface) ) ) } } }
for adb shell am ? can you hel me for the command line ? thanks before
@Mygod Hello, I wanted to ask you a question, since I am trying to compile the application. I already managed to get the vpn and hotspot to start automatically, but I want it to be activated automatically when I start the wlan0 application. Can you help me, I don't know very well what files to modify.
Fixed via #591.
@sea3pea0: https://github.com/Mygod/VPNHotspot/issues/9#issuecomment-401563308
And maybe MacroDroid as well?