Vpn app disconnecting in background

I have Shield from 2016. I have noticed recently that if I allow my vpn app (mullvad) to go too far into background, it gets pushed into standby mode and disconnects from the vpn servers. My guess is it has been like that for years but I didn’t notice until recently. ‘Background process limit’ is set to ‘Standard’ in developer options. Is there any way to set it so certain apps run all the time even when in background? Otherwise, any vpn app becomes pretty useless unless if I keep making sure the vpn is enabled everytime I open multiple apps.

There’s no way to set certain apps to always run (unfortunately) so no need to waste your time messing with settings like process limit.

The only way I know to do what you want is to use a custom launcher and add a widget to the home screen for your firewall. This is what I do and have done for years and my VPN(s) never disconnect or get closed by Android, I mainly use streaming apps that aren’t available in my country so I’d know by now if it was disconnecting.

I use Wolf Launcher, initially to enable the Widget function you need to enable Network Debugging in the Developer Settings and then, assuming you have a Windows computer or laptop, you’ll need to run 3 commands using Command Prompt as per below:

adb connect SHIELDIP:PORT

Example: adb connect 192.168.1.13:5555
(The IP address will be shown in the Developer Options once Networking Debugging is enabled)

adb shell

appwidget grantbind --package com.wolf.firelauncher --user 0

You can then disable Network Debugging afterwards if you want.

i didnt get - so you adding widget from wolf , what if my SSTP vpn app doesnt support any widgets?

What does the third step do? Does it keep the vpn open or show status of vpn on home screen?

It allows the Wolf Launcher permission to place widgets on the home screen, if you try to add one without doing it, it won’t let you. It’s the exact same function as what you see on a regular android phone when you add the weather or whatever to a home screen (they’re not widgets meant for TV), you still need to add/choose what Widget(s) to add yourself.

Here is my home screen + how it looks when you’re selecting a widget. As you can see I have 2 VPN widgets (one for NordVPN and one for IPVanish) at the bottom left.

https://i.imgur.com/nMECW1k.jpg

https://i.imgur.com/Yib1haB.png

How much you can actually interact with the widget will vary, it depends on the VPN you’re using. I use a bluetooth mini keyboard that has a mousepad on it, so I can use you the mouse to click the power buttons on either and turn them on/off directly from the home screen, if I didn’t have a mouse pad, the IPVanish one can’t be interacted with at all and NordVPN, using the remote just opens the app (and the mobile UI version of the app, not the TV version that I see if I open the app with the regular icon). But interacting with it is not really the point, as long as the widget is there, it prevents Android from closing the VPN, just use the regular app to turn it off/on like you do now.