1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// This example demonstrates how to connect to an Android device and copy a file or directory to it
/// To run this example, execute:
/// ```sh
/// cargo run --example push
/// ```
use adb_utils::file_transfer::{push::ADBPush, CompressionAlgorithm};
use adb_utils::manager::ADBManager;

fn main() {
    let mut manager = ADBManager::new();
    match manager.connect("192.168.1.132", 40785) {
        Ok(()) => println!("Successfully connected"),
        Err(e) => println!("Could not connect: {}", e),
    }

    manager.cwd("C:\\Users\\Radu\\Desktop");
    let mut push = ADBPush::new("sample.txt", "/storage/emulated/0/sample.txt")
        .compression(CompressionAlgorithm::Brotli);
    match manager.execute_path_based(&mut push) {
        Ok(ok) => println!("{ok}"),
        Err(err) => println!("error {err}"),
    }
}