iiordanov/remote-desktop-clients

[FR] [freebVNC and bVNC Pro] Keep alive

Opened this issue · 32 comments

freebVNC or bVNC Pro keeps getting disconnected if my Android device is idle even if Keep Screen Awake is on on top of another app (Touch Blocker) with its own Keep Screen Awake enabled. Is there a way to keep the connection alive indefinitely while the device is idle as I use it to monitor my PC remotely?

App(s): bVNC Pro 5.2.9_115290 / freebVNC 5.2.9 (Allow foreground and background activity are both enabled for both apps)
Mobile: CPH2179 Android 10 (Power saving mode and Super power saving mode are both disabled)
PC: Windows 10 22H2 (Build 19045.4046) x64
VNC: RealVNC Enterprise 7.10.0 (r52269) x64
SSH: Bitvise SSH Server 9.32
Connection Type: Secure VNC over SSH (local connection only)

Screenshots:

Bitvise SSH Server - Keep-alive / broken connection detection: Disabled
Bitvise SSH Server Keep Alive disconnection disabled

RealVNC Enterprise - Disconnect users who have been idle for an extended period: Disabled
image

bVNC Pro settings
IMG_20240312_103433

I'm not sure but the only settings I can see from the app's properties are the allow background activity and allow foreground activity toggles which are both enabled. Here are the battery settings:

Power saving mode: Disabled
Super power saving mode: Disabled
Power saver options > Sleep Standby optimization: Enabled
High performance mode: Disabled
Optimized night charging: Disabled
Screen Battery Optimization: Off

Unfortunately, I'm not seeing the same things. Here are the screenshots of all related things I could find:

Screenshot_2024-03-14-08-53-42-58

Screenshot_2024-03-14-08-54-27-03

Screenshot_2024-03-14-08-54-45-39

Screenshot_2024-03-14-08-58-11-70

Screenshot_2024-03-14-08-58-23-08

Screenshot_2024-03-14-08-52-04-87

Screenshot_2024-03-14-08-52-20-84

If you mean "Allow background activity (description reads like: Do not restrict background activity for this app)," this is already enabled as you can see in the screenshots.

A Samsung device does have that option but the phones being used as monitors are Oppo CPH2179 (Android 10) & Oppo CPH2083 (Android 9).

For Oppo CPH2179, the only Special app access setting there is is Wi-Fi Control. Tapping on bVNC Pro from the App Management's App list leads me back to the App Info of bVNC Pro (screenshots have been posted above). No 3-dot menu in the App list, just 2-dots and it's "Show system". Battery usage can be seen from the App Info and it's already posted in one of the screenshots where it shows "Allow foreground activity", "Allow backgrtound activity" and "Allow auto launch" toggles. The 2 dot menu inside the "Battery usage" item contains only "Force stop" and "Function details". Force stop is, as you know, stopping the app while Function details is just an explanation of what Allow foreground activity and Allow background activity do. Any more ideas?

For Oppo CPH2083, App info contains Power Saver and Power Saver contains "Run in Background", "Don't run in Background" and "Smart Background Running (Recommended)". bVNC Pro was set to Smart Background Running and now I've chosen Run in Background and will let you know if the VNC keeps disconnecting.

Unfortunately, it still disconnects.
image

12hrs max but umm it wasn't exactly in the background when it disconnected earlier. Not even the touch blocker app was on. It just disconnected while in the foreground.

"[FR]" is in the title. I guess it wasn't clear that it is a Feature Request :D Originally I was using the free version and kept getting disconnected and then had the impression the pro version would have that feature as it wasn't clear to me what the differences are between free and pro. I ended up getting the pro, tried different VNC servers and it still happens. Hopefully it gets implemented. Thank you.

Got it. Is this going to be reopened as a feature request or...?

Reopening as agreed

Thank you. Is this also going to be implemented into the SPICE, RDP and oVirt/RHEL/Proxmox client apps? I just picked up Opaque for Android and planning on also getting the remaining apps for both Android and iOS, though I can only test RDP for the foreseeable future, if only there is a plan to implement the feature because Keep Alive / Staying connected is extremely important to me.

Hey @vavavr00m when I get to this feature it'll be available for all Android apps first.

No problem. Please let me know once it has been fully implemented for Android and for iOS. Thanks!

Enabling auto start and allowing background activity were done prior to this issue being filed. I have locked recents per one of the suggestions in the thread and am monitoring now. Thanks. Will keep you posted.

If it's in the foreground, even if the screen is off it stays connected for at least 6 hours but once it's in the background (just responding to some messages and browsing for a bit), it still gets killed.

image

That's a good one for other cases but the SSH will have stringent requirements - the SSH server will ban any (no exceptions) local and remote connections for 24hrs if an IP address attempts multiple connections within 24hrs.

On a Samsung Note 8 device, the connection also dies. I remember having a similar problem where I'd miss important notifications. I have searched for a solution previously and came out empty but found out that having a persistent notification will keep an app from getting killed by Android. Perhaps that is the reason why Tasker and a Rotation Manager app both have a persistent notification. Is it worth looking into adding a persistent notification to keep the app from getting killed? Not sure how significant of a task it will be but hoping any way to maintain connection will be implemented in some form.

Gotcha. If you ever get around to implementing it or decide to reject the request due to complexity, please ping me. Thanks! New permissions - I don't mind granting access but some users may not like unnecessarily providing permissions but if it's presented in a way that people will only be asked to grant specific permissions in order to use the feature then I see no problem with it.

I was recently reminded of questions around making the application survive longer in the background. On a modern Android, the list of steps includes but may not be limited to:

  1. Go to Settings->Apps, and find the application (bVNC, aRDP, aSPICE, Opaque, etc) whichever is the app you want to keep from being killed

  2. Scroll down to where it says Battery and tap/click that

  3. Set it to "Unrestricted"

  4. Next steps vary by device. On a Samsung, you can go to Settings->Battery->Background usage limits->Never auto sleeping apps->Hit the plus button, find and select whichever app you want (bVNC, aRDP, aSPICE, Opaque, etc.)

  5. Another thing you can try in case you don't mind installing AccuBattery is to disable optimization for the app

  6. Install AccuBattery

  7. Once you have it, you can go to Settings->Battery optimization->Open power optimization settings->Change to show All Apps->Toggle the button next to the app you want to disable optimization for to the OFF position (bVNC, aRDP, aSPICE, Opaque, etc.)

Does that help?

Pretty sure only thing I didn't try was AccuBattery. I will try it when I get the chance and let you know how it turns out. Thanks.

@vavavr00m any update? Did the accubattery route provide any improvement?