KDE connect never stays connected to android phone for very long

Kde Connect never stays connected for very long, and I don’t think it’s anything to do with the phone’s power saving control systems.

I have a few Android phones that i have tested with.

After a while (cant say exactly) It just shows “Paired device is unavailable.” If I log out and log back in on the desktop, it works again and automatically reconnects, so I don’t think it’s the phone.
I have disabled all power-saving options for its app on Android as well.

I have tested putting the system to sleep and waking it up, but it remained connected, so it’s not specifically sleep that causes the issue. However, I do use sleep much more than shutdown, so the desktop is often asleep for long periods. I’m not exactly sure when or what causes it to become disconnected and unavailable. If I knew, I might be able to write a script to reset Kde Connect at that point, but I’m unsure how to do that or when to use it.

I don’t know, it will be connected when i first start the computer but when i next look up to check its icon is still showing its gone and i cant connect any more without re-logging out/in.

inxi -b

System:
Host: greg-optiplex7050 Kernel: 6.6.7-4-MANJARO arch: x86_64 bits: 64
Desktop: KDE Plasma v: 5.27.10 Distro: Manjaro Linux
Machine:
Type: Desktop System: Dell product: OptiPlex 7050 v: N/A
serial:
Mobo: Dell model: 055H3G v: A01 serial: UEFI: Dell
v: 1.26.0 date: 08/20/2023
CPU:
Info: quad core Intel Core i5-7500 [MCP] speed (MHz): avg: 850
min/max: 800/3800
Graphics:
Device-1: Intel HD Graphics 630 driver: i915 v: kernel
Display: x11 server: X.Org v: 21.1.10 with: Xwayland v: 23.2.3 driver: X:
loaded: modesetting dri: iris gpu: i915 resolution: 1920x1080~60Hz
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 23.1.9-manjaro1.1
renderer: Mesa Intel HD Graphics 630 (KBL GT2)
Network:
Device-1: Intel Ethernet I219-LM driver: e1000e
Device-2: Intel Wireless 8265 / 8275 driver: iwlwifi
Drives:
Local Storage: total: 1.84 TiB used: 171.44 GiB (9.1%)
Info:
Processes: 202 Uptime: 1d 21h 43m Memory: total: 16 GiB available: 15.48 GiB
used: 3.57 GiB (23.1%) Shell: fish inxi: 3.3.31

This command seems like it should refresh the connection; if that helps:

kdeconnect-cli --refresh

If you haven’t updated kdeconnect on your phone for a while, that could potentially be a consideration. I have nothing else to offer at this time. Good luck.

Yea i tried that one but had no effect to the availability of the phone and its connection. It remains “unavailable”. This is the “drop-down” widget menu after issuing that command :-

image

There is no way i can get the connection to come back that i can find, except logout and back in. Not on the desktop or the phone.

These I have some things iv tried

killall kdeconnectd
killall kdeconnect
kdeconnect-cli -d
kdeconnect-cli --refresh
systemctl restart kdeconnectd

Did you try this combination?

killall kdeconnectd && kdeconnect-cli --refresh

… or, rebooting/reinitializing your phone?

Otherwise, you could try renaming the configuration folder:

mv ~/.config/kdeconnect ~/.config/kdeconnect-backup

… or, deleting it:

rm -rf ~/.config/kdeconnect

… followed by re-pairing (pairing again), and a reboot.

Yea, no joy :frowning:

I havent removed the config’s but i have got several phones and they all act the same, i have removed a load of them and recreated the pairing but still the same on all phones. This is a new system with a new install of Manjaro kde but Manjaro on my laptop was/is just the same anyhow.

I shall try it but its a very long shot

What does the interface on your phone say if you start it while it says it’s unreachable from Manjaro?

To me, everything points to this being on the phone side.
Especially since restarting kde-connect on your Manjaro does nothing.

Ahh thats what i would have thought until i find that just logging off on my desktop and back in again and it all reconnects just fine (for a little while). I have a strong feeling it has to do with the desktop going to sleep for a reasonable period but i cant recreate it on demand.

O and i can refresh the phone by pulling down on the screen as many times as i like, it tries to refresh the connection but can not do it.

And you ARE on the same network, there is not some kind of vlan setup with briges and stuff?

As an example. I have noticed if I forget to disconnect my phone to my LAN vpn I use when I am outside my wifi (so I am on the same lan, but connect in a loop back to the vpn via internet, confusing it even works to be honest), it will show behavior you describe, connect and disconnect.

This might test it quickly; maybe change the duration as needed.

sleep 10

No, nothing like that, just a normal router & wifi connection for testing this.

? When i said desktop going to sleep, i mean system suspend and resume

I suppose I was being facetious.

The few similar issues I found in a quick search all seemed to point to power saving settings as the culprit. If you’re confident it’s not that, then I don’t know what else to suggest that you haven’t tried already.

Ok. Just wanted to make sure. No vpn:s on phone or computer in use.
I suspect there is something with network rather than a program issue.

Can you ping the ip of the phone from Manjaro when it says it’s unreachable?

Yes i can.

Iv got it connected again atm without using the user logout/in. I think it might possibly have been a conjunction of some or all of the things we have tried.

I put a bet on doing both of the following:-
kdeconnect-cli --refresh
refresh the kde-connect app on phone by pulling down the screen

I shall have to wait until it disconnects again and test that theory, but even if it is it still don’t help me keep it connected. I can do a script to do kdeconnect-cli --refresh if it drops out, but not so easy to script on the phone.

But that would leave me wondering why logging out and in did not need me to refresh the phone though? hmm we shall see.

This is a longshot, and at face value it shouldn’t make a difference.

However, in plugin settings I have Inhibit screensaver (when device is connected) which isn’t enabled by default. See if enabling that will also prevent the apparent disconnecting.

→ I did say it was a longshot.

Firewall involved on desktop PC?

Difference between connection success and connection fail? (on desktop):
ss -atunp
and
arp -a

Ok i shall get that info but will have to wait until it disconnects itself again.

I dont use a firewall, i dont have arp installed, not even sure which package that might come with?

Then do
ip neigh show

I assume you have android-udev installed

Why would you assume that? I think kdeconnect was installed either as a panel widget or directly with Pacman, but I never see anything stating that I should have installed android-udev. If it’s a requirement (dependency), surely it would have been installed along with kdeconnect. I do not have android-udev installed though, should i install it?

Which devices and what version of Android are they running?

I have no issues on my Pixel 8 running Android 14 with both GSConnect and occasional testing of Valent on GNOME. :man_shrugging:

Does it reconnect when you wake the screen? Depending on the manufacturer / Android version, the KDE Connect Android app may be getting killed in the background.

See: