Go to file
Sebastian Hugentobler bd8c14d741
ci/woodpecker/manual/woodpecker Pipeline failed Details
Add '.woodpecker.yml'
2022-11-11 07:07:12 +00:00
qr_web initial commit 2021-08-09 11:56:46 +02:00
res initial commit 2021-08-09 11:56:46 +02:00
scripts initial commit 2021-08-09 11:56:46 +02:00
.gitignore initial commit 2021-08-09 11:56:46 +02:00
.woodpecker.yml Add '.woodpecker.yml' 2022-11-11 07:07:12 +00:00
Dockerfile initial commit 2021-08-09 11:56:46 +02:00
README.md Update README.md 2021-08-11 14:20:53 +00:00
Toren1BD.posters initial commit 2021-08-09 11:56:46 +02:00
fluxbox_menu initial commit 2021-08-09 11:56:46 +02:00
fluxbox_startup initial commit 2021-08-09 11:56:46 +02:00
qr.png initial commit 2021-08-09 11:56:46 +02:00

README.md

Headless Android Emulator for WhatsApp

An android emulator, running on a headless Debian installation, accessible by vnc inside a browser.

Motivation

Where I live, WhatsApp is ubiquitous, which leads to some problems for me. Firstly, I do not want to use it but the network effect is too strong and I also do not want to cut off everyone like that.

However, I run the great Matrix-WhatsApp puppeting bridge to bridge my Whatsapp conversation into the Matrix network. Because it works with WhatsApp web, I still need the WhatsApp client itself running on my phone.

As I use LineageOS with microG, Firebase Cloud Messaging (the thing mostly responsible for push notifications on Android) does not work (neither am I interested in it), meaning I need to open the App from time to time or the bridge loses the connection.

This is where this emulator contraption comes into play. It segregates WhatsApp to a server running somewhere, and the most important part, it does not lose the connection to the bridge.

It is important to acknowledge the huge amount of work that I am building this upon, I merely connected some pieces and I am very grateful to all the used projects.

Usage

Build the docker image, this can take a while (the android sdk has a bit of a size). While my own images are public, I would advise not to rely on them and also take a look at what you are actually building. If you trust me blindly with this, you might as well give me access to all your chats.

The image needs to be run in privileged mode and the host must have access to virtualization (which is also why I have no clue if this even works outside of Linux hosts).

A docker incantation might look like this:

docker run -it --privileged --device=/dev/kvm -p5000:5000  -p6900:6900 -v emu_vol:/opt/android/.android/avd/x86.avd/ android-emu

Accessing port 6900 gives you access to the Linux installation, via vnc (thanks to the noVNC project for making that part so easy). The emulator should start automatically, if it does not, right click anywhere onto the desktop and choose emulator in the context menu. Booting the emulator can take a while, depending on the power of the host system.

starting the emulator emulator after start

Installing WhatsApp

It can be installed in a number of ways (including using the play store proper), here I am explaining how I do it.

Open chrome, navigate to https://f-droid.org and install it (it will prompt to allow it for security reasons, that is normal and can be done). When opening f-droid, it will initialize the repositories, after that search for Aurora Store and install it.

download f-droid install aurora store

Now open the aurora store, accept the default configuration, grant the requested permissions and either login with a google account (usually more stable) or try the anonymous route. Finally WhatsApp can be installed and opened from it.

install whatsapp

Configure WhatsApp

The WhatsApp configuration works the same as always, you only need to put in the code yourself because that is of course sent to your actual phone.

Start the authentication by sending the login command to your whatsapp bridge bot as described here. Explaining the installation and configuring of the bridge is out of scope for here, the documentation of the project itself will help with that.

Download the displayed qr code and navigate to wherever port 5000 of the running image is accessible.

upload qr code

Upload the qr code you downloaded before, this will inject it into the android virtual scene that the emulator's camera sees.

Be aware that the website for uploading is not doing any sanity checking whatsoever, it is on the user to provide a valid png image.

Open the linked devices menu in WhatsApp and add a linked device.

add linked device allow scanning

The uploaded qr code gets shown and will be picked up automatically by WhatsApp. qr code scanning

Now the matrix bot should be connected and the bridge working.

Caveats

If the desktop and the upload page should be accessible over the internet, suitable authentication must be ensured, otherwise anyone stumbling across it has access to the chats and everything (and automated tools will find it).

This can be as simple as putting a reverse proxy with basic authentication in front of it.

The path /opt/android/.android/avd/x86.avd/ should be made persistent, otherwise the installation needs to be performed again after every reboot.

Nothing described here is in any way officially sanctioned, I have been using the whatsapp bridge for several years now but there is no guarantee for its correct working and the safety of your account.