android-emulatoradbpidhwndbluestacks

get Window Name / PID / hwnd of android emulator with ppadb


I am trying to get the window name of bluestacks android emulators, which aren't static.

The PID would also be enough since the window names are obtainable with it, but device.get_pid just returns:

<bound method Utils.get_pid of <ppadb.device.Device object at 0x0000011591F9AF10>>

One thought was to just list all Bluestacks processes, but i'm unsure if i can get the device ip off of the process list, and the device ip and window name should be from the same emulator of course.

One solution was to get the Nickname or avd name of the device with adb shell:

adb shell getprop | grep "ro.product.nickname"

but that option returns nothing and i didn't find it in the adb documentation either so i cannot confirm if this is working for emulators, and neither bluetooth nor device names which i was able to find using grep are the window name.

Since the "window name" i'm looking for is the nickname you give a Bluestacks Instance when creating it, i assumed it could have been set as bluetooth or device name. But atleast the PID should be obtainable.

The only outputs i am able to get right now are the ip (device.serial), name (for example emulator-5545) and the return of adb.devices in this format:

<ppadb.device.Device object at 0x0000025D84A38F10>

so if there is any way i can get the PID, hwnd, or window name directly through adb shell i would appreciate the help.


Solution

  • What i was looking for was the file bluestacks.conf,

    "C:\ProgramData\BlueStacks_nxt\bluestacks.conf"

    which contains all the information i'm looking for, especially the "display_name" which is the instance name.

    enter image description here