Bug 457399

Summary: Unable to reconnect to PC when in background (Current network isn't trusted, not broadcasting)
Product: [Applications] kdeconnect Reporter: i
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Android   
OS: Unspecified   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Android log
Permission log (Chinese)

Description i 2022-08-02 07:22:16 UTC
Created attachment 151065 [details]
Android log

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Install the applications and pair them.
2. Lock the screen of the Android device with KDE connect in the background, and leave it there for some time (maybe ~ 30 minutes)

OBSERVED RESULT
The phone is disconnected from the PC and does not reconnect until KDE Connect app is brought to the front by clicking on the notification.

EXPECTED RESULT
Disconnection is expected since there can be network suspension and restriction in place, but reconnection should be attempted.

SOFTWARE/OS VERSIONS
Windows: 10
Windows KDE Connect: 22.04.1
Android: 12 (MIUI 13)
Android KDE Connect: 1.19.1 (F-Droid)

ADDITIONAL INFORMATION
It seems that the Android app is trying to read the currently connected WiFi SSID with APIs that require location permissions to work: I have seen multiple occurrences of "KDE Connect has been denied location access in the background". However, there is no option to give the app background location access, the only available options are "Disallow", "Ask",  and "Allow while using".

Since I opt to not trust all networks, it does not attempt to reconnect.
Comment 1 i 2022-08-02 07:24:09 UTC
Created attachment 151067 [details]
Permission log (Chinese)

You might need to google translate this image.
Comment 2 Albert Vaca Cintora 2023-03-23 17:52:51 UTC
Reconnection on Android 9+ should be much better since https://invent.kde.org/network/kdeconnect-android/-/commit/fd34e56675dd7e982e22abb051400804ab5ede67 

Please reopen if it isn't.