![]() Now we can create a new python file and check if we can find our connected device using the library:Ī diagram to show how the coordinate system works Hopefully if everything works out, you should be able to see your device on your PC and be able to control it using your mouse and keyboard. ![]() However, this will only work if you added it to your path, otherwise you can open the executable by changing your terminal directory to the directory of where you installed scrcpy and typing scrcpy.exe. If you also installed scrcpy, then you can start that by just typing scrcpy into the terminal. This should print out the following messages: * daemon not running starting now at tcp:5037 * daemon started successfully Then on your PC, open up a terminal window and start the ADB server by typing in adb start-server. Firstly, connect your device to your PC with the USB cable, if USB debugging is enabled then a message should pop up asking if it is okay for your PC to control the device, simply answer yes. Now that all the dependencies are installed, we can start up our ADB and connect our device. This is so we can access the program from anywhere on our system just by typing in scrcpy into our terminal window. If you are on Windows, then extract the zip file into a directory and add this directory to your path. To install it, you can head over to the Github repo and download the correct version for your operating system (Windows, macOS or Linux). Optional: To make things easier for us while developing our scripts, we can install an open-source program called scrcpy which allows us to display and control our android device with our computer using a mouse and keyboard. You can install the pure-python-adb library using pip install pure-python-adb. Once you have installed the ADB tool, you need to get the python library which we will use to interface with the ADB and our device. Otherwise, you can head over to the official docs and at the top of the page there should be instructions on how to install it. ![]() This comes automatically bundled with Android Studio, so if you already have that then do not worry. The first of the 2 things we need to install, is the ADB tool on our computer. Here is what todays journey will look like: Now the only other thing you need is a USB cable to connect your device to your computer. Then you can go to the Developer Options panel in the settings and enable USB debugging from there. Click the build number 7 times and Developer Options will be enabled. To unlock developer options, you can go to your devices settings and scroll down to the about section and find the build number of the current software which is on the device. To enable the ADB, your device must firstly have Developer Options unlocked and USB debugging enabled. You can do many things such as install apps, debug apps, find hidden features and use a shell to interface with the device directly. The ADB (Android Debug Bridge) is a command line tool (CLI) which can be used to control and communicate with an Android device. In this quick guide I will show you how you can interface with it using Python and how to create 2 quick scripts. Photo by Caspar Camille Rubin on Unsplash IntroductionĪ while back I was thinking of ways in which I could annoy my friends by spamming them with messages for a few minutes, and while doing some research I came across the Android Debug Bridge.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |