Skip to content

Pairing Your Android Virtual Device With The Desktop Version

Quentin Hibon edited this page Nov 22, 2020 · 3 revisions

If you want to both develop and use Signal applications at the same time, you may stumble upon some conflicts. Currently, you can't have both self-compiled version and the Play Store version of Signal-Android on a single device, this led me to finding a way of running Signal-Android in an Android Virtual Device (AVD) via the Android Development Tools (ADT) IDE. If you have problems running Signal-Android on your AVD, this guide might help you. This guide assumes you have basic knowledge about Java, ADT and HTML, and have Google Chrome installed.

The steps

  1. Follow this guide to get the Signal-Desktop extension and the Signal-Android project. Don't run the applications just yet.
  2. If you have a web camera and you can use it as the camera of the virtual device,
    1. Simply pair the device using the connected web camera, how you would pair it normally.
  3. If you do not have a web camera or it isn't working properly with the AVD, we are going to hack the Signal-Android code to not use the web camera at all, but use our hardcoded data of the QR code instead. We will remove the added code afterwards.
    1. Install QtQR. You may use any QR code image parser, I'm going to assume you have this one.
    2. Open the org.thoughtcrime.securesms.qr.ScanningThread class in Android Studio.
    3. Insert the following code at the beginning of the run method of the ScanningThread class (line 60 at the time of writing):
      if(true)
      {
        scanListener.get().onQrDataFound("QR_CODE_CONTENT");
        return;
      }
  1. Open the self-compiled Signal-Desktop and go through the dialog until you see the QR code.
  2. Right-click on the QR code and click on Inspect element.
  3. Copy the content of the image's src tag. It should look similar to this: data:image/png;base64,iVBORw0KGgoAA..., but a lot longer.
  4. Paste the copied data to your browser's URL bar.
  5. Right-click the image and click on Save image as... and save it somewhere.
  6. Open QtQR. On bottom left, click Decode and Decode from File, and choose the downloaded image.
  7. In the pop-up dialog, click Edit and copy the contents of the text area on the left labeled as Text to be encoded:.
  8. Replace QR_CODE_CONTENT in the inserted Java code with the data you just copied. It should now look similar to this:
...
    @Override
    public void run() {

      if(true)
      {
        scanListener.get().onQrDataFound("tsdevice:/?uuid=mkLeaJMYuHEZoyCe1234eA&pub_key=BTRflMuyMQRS%2F%2Bat9%2DQlkjYhPlq%2BtTK7VFG228My8RZj");
        return;
      }

      while (true) {
        PreviewFrame ourFrame;

        synchronized (DeviceAddFragment.this) {
          while (scanning && previewFrame == null) {
...
  1. Run the Signal-Android in your AVD, click on the menu in Signal, Settings, Devices and the + button on bottom right.
  2. Confirm to pair the devices.
  3. You can now remove the added Java code and finish pairing your devices.