iiordanov / remote-desktop-clients

VNC, RDP, SPICE, and oVirt/RHEV/Proxmox Clients for Android and Blackberry 10
GNU General Public License v3.0
2.03k stars 562 forks source link

[FR] [freebVNC and bVNC Pro] Keep alive #538

Open vavavr00m opened 3 months ago

vavavr00m commented 3 months ago

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

iiordanov commented 3 months ago

Have you tried to set bVNC to "not optimized" in battery settings? The instructions vary by device for that.

On Mon, Mar 11, 2024, 10:52 p.m. vavavr00m @.***> wrote:

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 https://play.google.com/store/apps/details?id=com.clstudios.screenlock&hl=en&gl=US) 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 image.png (view on web) https://github.com/iiordanov/remote-desktop-clients/assets/4675132/c462fe58-babb-4b99-ae12-a7432609e365

RealVNC Enterprise - Disconnect users who have been idle for an extended period: Disabled image.png (view on web) https://github.com/iiordanov/remote-desktop-clients/assets/4675132/138c2d2a-8aeb-4902-b265-ff89bd210156

bVNC Pro settings IMG_20240312_103433.jpg (view on web) https://github.com/iiordanov/remote-desktop-clients/assets/4675132/319244ee-dbcc-47db-ba9e-9d1f44d31330

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV2NK2ZZVBCOZYXK4PTYXZUVHAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4DANRRGU2TONA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

vavavr00m commented 3 months ago

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

iiordanov commented 3 months ago

Well, I went hunting on my Android 14 device and while the apps I set to unrestricted battery usage remain unrestricted, it looks like the toggle is now gone on my device :(...

Example procedure from another app that used to work until a month ago:

https://support.covenanteyes.com/hc/en-us/articles/13287066552987-How-do-I-configure-battery-settings-with-Android-13-or-14-on-an-Android

On Tue, Mar 12, 2024, 1:41 a.m. vavavr00m @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1990623796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV3DEZTELJD5QTPGIG3YX2IPTAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJQGYZDGNZZGY . You are receiving this because you commented.Message ID: @.***>

iiordanov commented 3 months ago

I got it! They hid the unrestricted option behind a tap on the "Allow Background Usage" text. Who knew that it's tappable? Only the Settings developers, I'll bet!

On Tue, Mar 12, 2024, 7:17 p.m. i iordanov @.***> wrote:

Well, I went hunting on my Android 14 device and while the apps I set to unrestricted battery usage remain unrestricted, it looks like the toggle is now gone on my device :(...

Example procedure from another app that used to work until a month ago:

https://support.covenanteyes.com/hc/en-us/articles/13287066552987-How-do-I-configure-battery-settings-with-Android-13-or-14-on-an-Android

On Tue, Mar 12, 2024, 1:41 a.m. vavavr00m @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1990623796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV3DEZTELJD5QTPGIG3YX2IPTAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJQGYZDGNZZGY . You are receiving this because you commented.Message ID: @.***>

vavavr00m commented 3 months ago

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

vavavr00m commented 3 months ago

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.

iiordanov commented 3 months ago

Samsung

Depending on the phone model, go to the smartphone's settings and follow these steps:

  1. Tap on "Applications" or "Apps"
  2. Tap on the three-dot menu (top right corner)
  3. Tap on "Special Access"
  4. Tap on "Optimize Battery usage"

OR

  1. Tap on "Device maintenance"
  2. Tap on "Battery"
  3. Tap on "Battery Usage"
  4. Tap on the three-dot menu (top right corner)
  5. Tap on "Optimize Battery usage"

On the "Optimize Battery" screen, if the bVNC app is not listed as “Apps Not Optimized”, tap on "Apps not optimized" and then tap on "All apps". Search for "bVNC" and disable that option.

vavavr00m commented 3 months ago

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.

iiordanov commented 3 months ago

Run in background sounds like the right option for your Oppos. The interface looked like a Samsung phone and that's why I sent the Samsung instructions.

On Thu, Mar 14, 2024, 12:18 a.m. vavavr00m @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1996372265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV67JQFMLIHBRPKRE2LYYEQH5AVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWGM3TEMRWGU . You are receiving this because you commented.Message ID: @.***>

vavavr00m commented 3 months ago

Unfortunately, it still disconnects. image

iiordanov commented 3 months ago

Wait, how long do you require for the app to remain connected while backgrounded? Permanently?

On Thu, Mar 14, 2024, 8:35 p.m. vavavr00m @.***> wrote:

Unfortunately, it still disconnects. image.png (view on web) https://github.com/iiordanov/remote-desktop-clients/assets/4675132/bdb4be96-f007-42ae-a166-dd22b71d665c

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1998696525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV2HUYEM64KLGSUPZYTYYI65VAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGY4TMNJSGU . You are receiving this because you modified the open/close state.Message ID: @.***>

vavavr00m commented 3 months ago

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.

iiordanov commented 3 months ago

I'd say something is up with the network if it disconnects in the foreground!

On Thu, Mar 14, 2024 at 9:19 PM vavavr00m @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1998729240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV5MRMZ54OZY2F3PRBLYYJEAJAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYG4ZDSMRUGA . You are receiving this because you modified the open/close state.Message ID: @.***>

-- The conscious mind has only one thread of execution.

iiordanov commented 3 months ago

If you want for a feature to maintain connectivity in the background for 12hrs, it will require some pretty specialized work and we can treat this as a feature request.

On Fri, Mar 15, 2024 at 6:32 PM i iordanov @.***> wrote:

I'd say something is up with the network if it disconnects in the foreground!

On Thu, Mar 14, 2024 at 9:19 PM vavavr00m @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-1998729240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV5MRMZ54OZY2F3PRBLYYJEAJAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYG4ZDSMRUGA . You are receiving this because you modified the open/close state.Message ID: @.***>

-- The conscious mind has only one thread of execution.

-- The conscious mind has only one thread of execution.

vavavr00m commented 3 months ago

"[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.

iiordanov commented 3 months ago

FR is usually an abbreviation for French to me, and since the apps have to support various languages, at a glance of the ticket title that would be my first interpretation. GitHub has tags to distinguish bugs from enhancements but I am not sure whether you can set those.

On Sun, Mar 17, 2024, 10:23 p.m. vavavr00m @.***> wrote:

"[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!

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-2002760105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV7VETUBY27XO3Y3RGLYYZFYNAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSG43DAMJQGU . You are receiving this because you modified the open/close state.Message ID: @.***>

vavavr00m commented 3 months ago

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

iiordanov commented 3 months ago

I'll look into reopening it.

On Tue, Mar 19, 2024, 3:48 a.m. vavavr00m @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-2006152289, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EV4EROFFI563262M6QTYY7UTJAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBWGE2TEMRYHE . You are receiving this because you modified the open/close state.Message ID: @.***>

iiordanov commented 3 months ago

Reopening as agreed

vavavr00m commented 3 months ago

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.

iiordanov commented 3 months ago

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

vavavr00m commented 3 months ago

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

iiordanov commented 3 months ago

Fun fact, I was recently doing development for Android TV, and the apps appear to happily run and stay connected in the background for hours on my Android TV box.

For Oppo, it seems to be a common issue that apps are aggressively killed. There appears to be a way to pin them to recents and select 5 apps to run in background. https://xdaforums.com/t/any-easy-solution-for-the-aggressive-app-killing.4384549/

On Mon, Apr 1, 2024, 5:30 a.m. vavavr00m @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-2029477684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EVZOBXSZK464NAHAM3TY3ESLRAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRZGQ3TONRYGQ . You are receiving this because you modified the open/close state.Message ID: @.***>

vavavr00m commented 3 months ago

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.

vavavr00m commented 3 months ago

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

iiordanov commented 3 months ago

Wouldn't it be a more general solution to prioritize implementing automatic reconnection to certain connections?

On Tue, Apr 2, 2024 at 6:44 AM vavavr00m @.***> wrote:

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 got killed.

image.png (view on web) https://github.com/iiordanov/remote-desktop-clients/assets/4675132/a9a503d0-0eb2-4c89-aa2d-632168624334

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-2031667933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EVZBB52HPB6JDAGCR4DY3KDYTAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGY3DOOJTGM . You are receiving this because you modified the open/close state.Message ID: @.***>

-- The conscious mind has only one thread of execution.

vavavr00m commented 3 months ago

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.

iiordanov commented 3 months ago

I haven't researched recently, but a persistent notification is what I remember from years ago. It is not a trivial amount of work and if it requires new permissions will be something to consider.

On Wed, Apr 3, 2024, 7:44 a.m. vavavr00m @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/iiordanov/remote-desktop-clients/issues/538#issuecomment-2034354347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK3EVYKE5MHXICFHPI33V3Y3PTRBAVCNFSM6AAAAABERNCSBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZUGM2TIMZUG4 . You are receiving this because you modified the open/close state.Message ID: @.***>

vavavr00m commented 3 months ago

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.