Home > front end >  how to open an app on ldplayer using python
how to open an app on ldplayer using python

Time:12-19

i am creating a piece of code that can be manipulated on LDPlayer emulator software. I am using subprocess and adb module to open LDPlayer, but now after LDPlayer runs it doesn't open the app I need (here is discord). I have tried quite a few ways and researched on forums, youtube but still cannot open the application. There are instructions that can open the application by just the application name (Discord), and another guide that can be opened using the name of the application's installation folder (com.discord). Can someone help me, thank u all!

import subprocess
import requests
from time import sleep

# Get the proxy URL from the API
response = requests.get("https://app.proxyno1.com/api/change-key-ip/my-apikey")
status = response.json()["message"]
print('Status:', status)

# Start the LDPlayer emulator (proxy server:port already setting)
ldplayer_path = "C:\LDPlayer\LDPlayer9\dnplayer.exe"
adb_path = r"C:\Users\PC\Desktop\Test\platform-tools\adb.exe"
process = subprocess.Popen(ldplayer_path)
process.wait()

# Use the LDPlayer emulator to run Discord
subprocess.run([adb_path, "shell", "am", "start", "-s", "emulator-5554", "-n", "com.discord/com.Discord.MainActivity"])

CodePudding user response:

Try

subprocess.run([adb_path, "-s", "emulator-5554", "shell", "am", "start",  "-n", "com.discord/com.Discord.MainActivity"])

as -s <serialno> is an argument for adb not for am.

  • Related