Use ADB & Fastboot Commands Without a Computer

Use ADB & Fastboot Commands Without a Computer
ADB and Fastboot are powerful tools, but they've almost always required a computer. Now, you can totally break free of this by using two phones if you wanted to. It might be easier to purchase a cheap Android phone that can be rooted to use as your ADB and Fastboot source rather than buying a computer. This opens up an endless number of possibilities.
In the earlier days of Android before Marshmallow, it had previously been possible to run these commands through the system, but that's no longer the case. However, the ADB and Fastboot Magisk module, by XDA developers osm0sis and Surge1223, will once again enable this lost feature on the system level via root access. It works systemlessly as well, which means it won't trip the SafetyNet flag.
In this guide, you'll learn how to do the same things with ADB and Fastboot that are possible when using a computer, but with a phone instead. This means you can also unlock the bootloader on other phones, install TWRP directly, and even root them via Magisk — no computer required! If anything, you can follow along and learn something new if you've never tried something like this before.

Requirements

This guide is mainly for someone who already has a rooted Android device and wants to try something different. If you don't currently have a spare phone with root access or don't know how to do that, then this might not be for you. You can always check the link below for the regular ADB & Fastboot computer instructions instead if needed.

Step 1Install ADB & Fastboot for Android

On your already-rooted phone, head into the Magisk Manager app, tap the menu button on the left, then go to "Downloads." Tap the search icon and type in the term "adb" to bring up the required module for the guide. Tap the download arrow once, then hit the "Install" option from there. Grant Magisk Manager access to your media if prompted by tapping "Allow," then it'll begin installing.
It won't take very long for the install process to finish, so after it's completed, hit the "Reboot" button to restart your device. Once your phone comes back from the reboot, then you can move on to the next step below.

Step 2Install the Termux App

Using the phone that has root access, you'll need a terminal app to send over the ADB and Fastboot commands to the other phone. Some phones allow you to use a system terminal through the developer options, but the most universal method would be to download the Termux app. When it comes to all things command-line, Termux is the best choice since it offers a great overall user experience.
  • Play Store Link: Termux (free)

Step 3Enable USB Debugging

On the secondary phone that you want to send commands to, you'll need to enable USB debugging in the developer options. This allows the phone to accept the commands just as if they were receiving them from a computer. The procedure is generally the same across all devices, but you can hit up the link below to get that taken care of. Just complete the first two steps, then continue with this guide.

Step 4Connect the 2 Android Phones

If you have two newer phones from the past few years, you'll probably only need a single USB Type-C cable to connect them together. However, if you don't have a Type-C cable that has the same connector on both ends, you'll need an OTG adapter. Many new phones come with this adapter in the box, so check and see if you have one laying around from a previous purchase.
If one of the phones is Micro USB and the other is USB Type-C, you'll need two things: a Micro USB OTG cable and a USB A to USB C cable. You can pick either of those up from Amazon for fairly cheap.
An example of two newer phones being connected with a single USB Type-C data cable.
If you need to use an OTG adapter, plug it directly into the phone that has root access and Termux installed, then connect the USB data cable from there to the other phone. Otherwise, you'll be using a Type-C to Type-C cable, which means it doesn't matter which phone you connect first since they both use the same connector. It all comes down to what cables you have available to you at the time.

Step 5Allow USB Debugging Permission

Once both phones are physically connected, the secondary phone should receive the "Allow USB debugging" prompt instantly. If not, reconnect the phone, and it should pop up from there. Tap the "Always allow from this computer" option, then hit "OK" to confirm the choice. This means your secondary phone will now be labeled as a trusted device and can send commands to the primary device at any time.
If your secondary device is a recent Samsung phone, you'll probably need to change the "USB controlled by" option via the file transfer notification. Change it from "Connected device" to "This phone," then once it's switched over, the USB debugging prompt should pop up. This might be the case for other specific devices as well, so keep that in mind if things aren't working for you right away.
If you want to prevent one phone from draining the battery of the other, be sure to disable the "Charge connected device" option. This only affects phones that have a Type-C charging port, so keep that in mind as well for future use.

Step 6Grant Root Access

Now, head over to the phone that has Termux installed so that you can grant it root access, which is necessary for all this to work. Type the following command in Termux, then press enter.
su
The above command will prompt Termux to acquire root permissions via Magisk. Confirm the Superuser request by tapping "Grant," then it will have full root access from here on out. You'll always have to execute this quick command whenever you do anything that requires root access in a terminal, but you won't have to tap "Grant" after the first time.

Step 7Verify Your Phone Connection

Now that your two phones are physically connected with one another, it's time to verify the connection to ensure everything is working correctly. On the rooted phone with the terminal access, type the following command in Termux, then press enter.
adb devices
This command will send a signal to the other phone to check if it can communicate with it through ADB. If successful, you should see a device ID pop up under the "List of devices attached" line in Termux. If you do see your device ID listed, then that means everything is working as intended!
(1) There won't be any devices listed if something went wrong. (2) If all is well, the device ID will be displayed with a unique identifier of numbers and letters.
To test out the new functionality a little more, type the following command in Termux, then press enter.
adb reboot
This command will send a signal over to your other phone that will force it to restart the system automatically. Neat! You just told one phone to reboot another phone via a command-line environment through the ADB interface.

Step 8Enjoy Your New ADB & Fastboot Commands

The two commands I listed above are obviously fundamental, but they're simply a gateway to the much bigger picture. You can use this new functionality to install all kinds of mods you want onto another phone, especially TWRP and Magisk. Being able to use one phone to mod another phone brings light to new possibilities — imagine unlocking the bootloader of a friend's phone right on the spot!
Alternatively, you should also be able to achieve the same end result with an Android tablet if you preferred to do it that way instead. As long as the tablet has an unlockable bootloader and can be rooted via Magisk, it should work just the same. Although Android tablets are not as popular in comparison to their smartphone counterparts, the option is still there to use if needed. Happy modding!

Comments

Popular posts from this blog

How to Change MAC Address in Android Devices – Termux community

SUDO INSTALLING FULL TUTORIAL