Android Development execute ADB command line command

Source: Internet
Author: User

1. Call the ADB command to install the app in Android development, install the app into the/system/app directory


    /**     * Install the app in use ADB command,this style is silent      *     *    /private void Adbinstalltheapp () {        // ADB push core code        String command = "CP" + "the Android apk file path" + "/system/app";        Process process = NULL;        DataOutputStream OS = null;        try {            process = Runtime.getruntime (). EXEC ("su");//The phone must be root,it can exctue the adb command            OS = new DataOutputStream (Process.getoutputstream ());            Os.writebytes (Command + "\ n");            Os.writebytes ("exit\n");            Os.flush ();        } catch (Exception e) {                e.printstacktrace ();            }    }

2. If you need to restart your phone with adb reboot, you can use the following command

String command = "adb reboot";

Note: Using the ADB command-line command is not possible if the phone is already rooted otherwise, you cannot execute the Andy Board command


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.