ws-scrcpy icon indicating copy to clipboard operation
ws-scrcpy copied to clipboard

drag and drop - adb install .apk

Open krishtoautomate opened this issue 4 years ago • 11 comments

possible to add functionality for drag-n-drop an apk file to install automatically.

or

upload an apk to install to device

krishtoautomate avatar Sep 06 '21 01:09 krishtoautomate

import Bluebird from 'bluebird';
import Adb from '@devicefarmer/adbkit';

const client = Adb.createClient();
const apk = 'vendor/app.apk';

const test = async () => {
    try {
        const devices = await client.listDevices();
        await Bluebird.map(devices, (device) => client.install(device.id, apk));
        console.log(`Installed ${apk} on all connected devices`);
    } catch (err) {
        console.error('Something went wrong:', err.stack);
    }
};

krishtoautomate avatar Sep 06 '21 01:09 krishtoautomate

Hi. You can upload apk-file to device by drag-n-dropping it into "video" while streaming (but only the *.apk)

README:

File push

Drag & drop an APK file to push it to the /data/local/tmp directory. You can install it manually from the included [xtermjs/xterm.js][xterm.js] terminal emulator (see below). You can install it manually from the included xtermjs/xterm.js terminal emulator.

In master branch I added file listing feature, you can upload any files anywhere (if you have permissions).

I don't like the idea of automaticall installation, but in theory you can add it here: https://github.com/NetrisTV/ws-scrcpy/blob/4247f2ae7a47a97d262f7456ad552053692914e4/src/server/goog-device/mw/FileListing.ts#L80-L82

drauggres avatar Sep 06 '21 09:09 drauggres

If drag and drop is not good idea to install apk, Can you add file upload option in tool bar which can install apk when user uploads

krishtoautomate avatar Mar 12 '22 05:03 krishtoautomate