Setting up KDE connect with bluetooth
What is KDE Connect ?
KDE connect is a collection of software to make your smartphone connect to your KDE desktop (it also works with Windows and probably Mac OS, but this is not the subject of this article).
With these software, you can:
- Receive notifications on your desktop
- Reply to SMS from your computer
- Send and receive files between your computer and your phone
- Use your phone as a (wireless) touchpad to control your computer or the opposite, etc...
- Execute remote command on your phone or your desktop
- Share clipboards
- And many more
The main issue with KDE connect
Although KDE connect is very good, it performs its magic via network packets, thus with WIFI (it would work with LAN I guess, but I don't know any phone with a Ethernet port).
WIFI advantages are the ubiquity and the high transfer rate, but it's also a huge battery consumer.
It also requires your phone to be connected to the same network as your computer which isn't always possible (like if your computer does not use its WIFI connection or if you have a office network connection where your smartphone isn't allowed to connect).
You can set a wireless access point on your phone (usually made to allow your computer to share your smartphone's Internet connection) but that means powering up both WIFI and your LTE modem for a local (non internet communication).
Solution
If you don't need utterly fast communication with your smartphone (understand, if you can stand that transferring a photo takes few seconds), using WIFI is not required and you can use Bluetooth instead.
KDE connect android and desktop source code have a "bluetooth" path, but they are disabled by default (you need to compile them to have them enabled). I did this but there was no config whatsoever to add the connection. Also, the Bluetooth path is not fully functional from what I understood from the developer's comments.
If you need this build, just ask I can send you the APK.
The solution I'm describing below involves using BlueZ to start a network connection over Bluetooth. Once the network connection is set up, you simply need to tell KDE connect on your phone to connect to the computer's assigned IP address, and you're done.
Prerequisite
On the computer
- A computer with a working Bluetooth hardware and software
- BlueZ installed on the computer and also bluez-utils (required for debugging, you can remove it afterward)
- KDE desktop (sorry Windows and Mac user)
- Linux system (I'm using Manjaro here for the examples and screenshots)
On the smartphone
- KDE connect app (download version from F-Droid since it doesn't have the Google's Play store limitation of not dealing with SMS)
- Bluetooth (obviously)
Step 1: Prepare KDE connect on your phone
Install KDE connect from F-Droid (or step 0: Install F-Droid).
Before launching KDE connect, you'll need to provide some authorizations (depending on your phone, it might ask you by itself, but it didn't on mine).
So you'll need to navigate to your Android's Settings screen and type "Authorization" in the search box.
Then select the KDE connect application and allow it to access the phone (sorry no screenshot here)
Step 2: Allow bluetooth connection sharing
Go to your phone's settings and type "share" in the search box. Then select "Via Bluetooth" page to allow sharing your connection via Bluetooth.
Step 3: Pair your phone to your computer
In your notification tray, click on the Bluetooth icon, and select "Connect"
Then accept the connection on the phone (you might need to go to the Bluetooth setting page first).
Step 4: Set up the network connection over bluetooth
In your notification tray, click on the network icon, then the Bluetooth icon and select "Connect"
Once it's connected, use the right rectangle to display the details of the connection (you need the IPv4 address):
Step 4: Start KDE connect link on your phone
Start KDE connect on your phone, and click the submenu button on the top right, and "Add a device by IP". You'll need to enter the IP address you've seen on the network page.
If all goes well, your computer name will appear on the device list on your phone. Click on the icon, and select "Associate". Click "Accept" on the computer and you're done.
Step 5: Give all authorizations
In the smartphone, you'll need to authorize all the features once it has correctly connected. Just follow the instructions displayed on your phone and you're done!