-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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.
- Follow this guide to get the Signal-Desktop extension and the Signal-Android project. Don't run the applications just yet.
- If you have a web camera and you can use it as the camera of the virtual device,
- Simply pair the device using the connected web camera, how you would pair it normally.
- 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.
- Install QtQR. You may use any QR code image parser, I'm going to assume you have this one.
- Open the
org.thoughtcrime.securesms.qr.ScanningThread
class in Android Studio. - Insert the following code at the beginning of the
run
method of theScanningThread
class (line 60 at the time of writing):
if(true)
{
scanListener.get().onQrDataFound("QR_CODE_CONTENT");
return;
}
- Open the self-compiled Signal-Desktop and go through the dialog until you see the QR code.
- Right-click on the QR code and click on Inspect element.
- Copy the content of the image's
src
tag. It should look similar to this:data:image/png;base64,iVBORw0KGgoAA...
, but a lot longer. - Paste the copied data to your browser's URL bar.
- Right-click the image and click on Save image as... and save it somewhere.
- Open QtQR. On bottom left, click Decode and Decode from File, and choose the downloaded image.
- In the pop-up dialog, click Edit and copy the contents of the text area on the left labeled as Text to be encoded:.
- 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) {
...
- Run the Signal-Android in your AVD, click on the menu in Signal, Settings, Devices and the + button on bottom right.
- Confirm to pair the devices.
- You can now remove the added Java code and finish pairing your devices.