Send coordinates from PC to Android Phone (Oreo or above) with Python (Tutorial Setup + Script)
Hello! Since I use Pokémod and now there's a shiny scanner, there's no need for me to click pokémons any more so I can just constantly teleport until a shiny shows up. That's why I decided to automate a bit the teleporting so that I don't even have to move from my computer unless I hear a notification.
What do you need?
You'll need the following things (you might have everything already installed):
GPS Joystick by The App Ninjas: https://play.google.com/store/apps/details?id=com.theappninjas.fakegpsjoystick (won't work with any other GPS Joystick app)
ADB (Android Debug Bridge) which you'll most likely have already downloaded to root your phone. You can download it from the official website here (windows): https://dl.google.com/android/repository/platform-tools-latest-windows.zip
Python: https://www.python.org/downloads/
And some text editor like Notepad++: https://notepad-plus-plus.org/downloads/
And lastly my script from GitHub: https://raw.githubusercontent.com/rapidsiege/coordteleport/main/coordspc.py (you can see the code following the link for the curious, it's very very simple). Right click, save as... and save it wherever you want. Or direct download: https://drive.google.com/file/d/1Dzm8_nYy9Yav74qbV-kioaDuYMPKr4BK/
How does it work?
First, we need to find out the path of your adb.exe and the phone's local IP.
- Go to the folder with adb.exe is. Copy the path (something like C:\Users\UserName\Documents\platform-tools).
- Connect your phone to the computer via USB.
- Open cmd, you can do it by pressing Windows Key + R and typing cmd in the box.
- Type "cd " and paste your path for adb, so something like this "cd C:\Users\UserName\Documents\platform-tools"
- Type "adb tcpip 5555"
- Type "adb shell ip -f inet addr show wlan0" and copy your phone's IP.
- Disconnect your phone from the computer via USB.
Second, we need to edit the python script with your path and phone IP.
- Open coordspc.py with any text editor like Notepad++.
- On the 3rd line (path = "") insert your adb.exe path that we previously copied and double the \s. It should look like this: path = "C:\\Users\\UserName\\Documents\\platform-tools".
- On the 4th line (phone_ip = "") insert your phone ip followed by :5555. It should look like this: phone_ip = "192.168.1.34:5555".
- Save the changes (CTRL+S) and exit.
Unless your phone IP changes, you won't need to repeat this steps ever again.
How does the script work?
- Simply open the script (coordspc.py) and you'll see a terminal similar to a cmd and asked to enter coordinates.
- Paste them, click enter and your GPS Joystick will teleport to this location on the background (you can have POGO always running on the screen and never change back again). The coordinates should follow this format: latitude,longitude (with no spaces) so for example 30.500000,-80.300000. (This was created with Pokédex100 coords in mind).
- To stop the script from running and disconnect your phone from the computer, type "quit" instead of pasting your coords.
Any questions, feel free to ask.
Posted Jan 20, 2021, 4:12 AM UTC
As a Python beginner enthusiast and PoGo lover I really appreciate this. Thank you for this. Definitely will take a look at the code too!