GithubHelp home page GithubHelp logo

xiaoyier / adb-mobile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wsvn53/adb-mobile

0.0 0.0 0.0 153 KB

Android Debug Bridge (adb) ported version for mobile apps, the goal of this project is supporting both iOS App and Android App to connect to Android devices in developer mode (TCP/IP Mode) and execute supported ADB commands by integrating the libraries generated by this project.

Shell 12.86% Ruby 8.94% C++ 45.96% C 5.30% Objective-C 20.93% Makefile 6.02%

adb-mobile's Introduction

adb-mobile

Android Debug Bridge (adb) ported version for mobile apps, the goal of this project is supporting both iOS App and Android App to connect to Android devices in developer mode (TCP/IP Mode) and execute supported ADB commands by integrating the libraries generated by this project.

Currently only iOS platform is supported, Android version is under development.

中文文档

Build Library

The project has already finished the build scripts to generate libadb in a few simple steps:

# 1. checkout all the submodules
git submodule update --init --recursive

# 2. build
make

The generated libadb product can be found in the output folder of the project directory, for iOS is "libadb.a" that you can located at output folder.

Integrate

iOS Project:

# Build Settings - Header Search Paths
HEADER_SEARCH_PATHS = $(SRCROOT)/../../output/include

# Build Settings - Library Search Paths
LIBRARY_SEARCH_PATHS = $(SRCROOT)/../../output

# Build Settings - Other Linker Flags
OTHER_LDFLAGS = -ladb -lc++ -lz

API Usage

iOS App:

#import "adb_puiblic.h"

// Enable trace debug message
adb_enable_trace();

// Setup the ADB listening port, the default is 5037
adb_set_server_port("15037");

// Setup the ADB private key and data directory, which is usually the Documents directory of the App
NSArray <NSString *> *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
const char *document_home = documentPaths.lastObject.UTF8String;
adb_set_home(document_home);

// Connecting Android devices
const char *argv[] = { "connect", "x.x.x." };
const char *output = null;
int ret = adb_commandline_porting(2, argv, &output);

// Execute the ADB commands
const char *argv[] = { "shell", "ip", "route" };
const char *output = null;
int ret = adb_commandline_porting(2, argv, &output);

ADB Status Callback:

// By define the adb_connect_status_updated callback method to get the adb connection status
void adb_connect_status_updated(const char *serial, const char *status) {
    NSLog(@"ADB Status: %s, %s", serial, status);
}

You can also see how to use this library in the example/adb-demo project.

adb-mobile's People

Contributors

wsvn53 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.