mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-15 07:28:30 +00:00
Created Pairing your Android Virtual Device with the desktop version (markdown)
@@ -0,0 +1,45 @@
|
||||
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 lead 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](https://github.com/WhisperSystems/Signal-Desktop/blob/master/CONTRIBUTING.md) 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](https://launchpad.net/qr-tools). You may use any QR code image parser, I'm going to assume you have this one.
|
||||
2. Open the `org.thoughtcrime.securesms.DeviceAddFragment` class in ADT.
|
||||
3. Insert the following code at the beginning of the `run` method of the `ScanningThread` class (line 148 at the time of writing):
|
||||
```
|
||||
if(true)
|
||||
{
|
||||
scanListener.onUrlFound(Uri.parse("QR_CODE_CONTENT"));
|
||||
return;
|
||||
}
|
||||
```
|
||||
4. Open the self-compiled Signal-Desktop and go through the dialog until you see the QR code.
|
||||
5. Right-click on the QR code and click on _Inspect element_.
|
||||
6. Copy the content of the image's `src` tag. It should look similar to this: `data:image/png;base64,iVBORw0KGgoAA...`, but a lot longer.
|
||||
7. Paste the copied data to your browser's URL bar.
|
||||
8. Right-click the image and click on _Save image as..._ and save it somewhere.
|
||||
9. Open QtQR. On bottom left, click _Decode_ and _Decode from File_, and choose the downloaded image.
|
||||
10. In the pop-up dialog, click _Edit_ and copy the contents of the text area on the left labeled as _Text to be encoded:_.
|
||||
11. 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.onUrlFound(Uri.parse("tsdevice:/?uuid=mkLeaJMYuHEZoyCe1234eA&pub_key=BTRflMuyMQRS%2F%2Bat9%2DQlkjYhPlq%2BtTK7VFG228My8RZj"));
|
||||
return;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
PreviewFrame ourFrame;
|
||||
|
||||
synchronized (DeviceAddFragment.this) {
|
||||
while (scanning && previewFrame == null) {
|
||||
...
|
||||
```
|
||||
12. Run the Signal-Android in your AVD, click on the menu, _Settings_, _Devices_ and the **+** button on bottom right.
|
||||
13. Confirm to pair the devices.
|
||||
14. You can now remove the added Java code and finish pairing your devices.
|
||||
Reference in New Issue
Block a user