03.01.2017       Выпуск 159 (02.01.2017 - 08.01.2017)       Интересные проекты, инструменты, библиотеки

an2linuxserver - синхронизация android notifications с Linux с помощью tcp или bluetooth


Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

AN2Linux - server

Sync android notifications encrypted to a linux desktop with tcp or bluetooth.

This is the server part of AN2Linux.

Link to client part


AN2Linux is my first (not tiny) program / app and I've been working on it for quite some time now. I wanted to make an2linux because it was something I needed and also to learn.

It's been a fun ride, I have learned a lot.

But be warned, there may be many bugs / problems. If you see something that is bad please tell me why and not just that it sucks.


I'm using archlinux but I've added here what I think to be the package names for debian/ubuntu as well.

Arch: python
Debian / Ubuntu: python3
Arch: libnotify
Debian / Ubuntu: libnotify4 gir1.2-notify-0.7
Arch: python-gobject
Debian / Ubuntu: python3-gi

For bluetooth:

Arch: python-pip
Debian / Ubuntu: python3-pip
Arch: bluez-libs
Debian / Ubuntu: libbluetooth-dev
pip3 install pybluez

How to use

First time just run an2linuxserver.py and follow the instructions.

AN2Linux uses TLS for encryption with both client and server authentication. That means that the client (android) and the server (your computer) need to exchange certificates first.

To initiate pairing you must have an2linuxserver.py running and then in the android app press initiate pairing when in the process of adding a new server.

For bluetooth:

First you need to pair your phone and computer with each other (the normal bluetooth pairing), and then do the certificate exchange as explained above.

Why use TLS over bluetooth when it's already encrypted?

Well, firstly, because I wanted to try :)

And secondly, from the little I've read about bluetooth it seems that the encryption key size negotiated can be very small.


I'm using archlinux so I'm going to tell you have it works for me, I have no idea how it works on other distros. It may work out of the box, just try it.

This is the error I get without the fixes below:
bluetooth.btcommon.BluetoothError: (13, 'Permission denied')

So, if you're not using archlinux but still systemd and get an error like that maybe you should try something similar.

Edit file:


Make the changes in an override file:

systemctl edit bluetooth.service

Add the following lines:

ExecStart=/usr/lib/bluetooth/bluetoothd -C
ExecStartPost=/bin/chmod 662 /var/run/sdp

then apply changes:

systemctl daemon-reload
systemctl restart bluetooth.service

More info about this problem: https://bbs.archlinux.org/viewtopic.php?id=201672.

Run in background:

You could just run an2linux in its own terminal window but maybe you want to have it run in background somehow and maybe to autostart.

There are many different ways to do that.

You could use screen/tmux or a systemd service.
The great thing about screen/tmux is that you can attach to it if needed.

With tmux you could use something like this:

tmux new -d -s an2linux '<path_to_an2linuxserver.py>'

Example user systemd service:


Description=AN2Linux server



Or you could combine tmux with a systemd service:


Description=AN2Linux server tmux

ExecStart=/usr/bin/tmux new -d -s an2linux '<path_to_an2linuxserver.py>'
ExecStop=/usr/bin/tmux kill-session -t an2linux



systemctl --user start an2linux.service


systemctl --user stop an2linux.service


systemctl --user enable an2linux.service


systemctl --user status an2linux.service


GNU General Public License 3, with the additional special exception to link portions of this program with the OpenSSL library.

See LICENSE for more details.

Лучшая Python рассылка

Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus