How can i get active ios device or simulator UDID?

Viewed 3883

I can get all available devices by "instruments -s device"

I am not able to identify which one is active device. How can i identify active device or simulator programmatically in JAVA.

Please help me.

Thanks.

2 Answers

This is not done programmatically in JAVA as originally asked, but might help someone.

To get all active iOS physical devices and iOS simulators with their UDIDs:

$ xcrun xctrace list devices

To find the active iOS simulator with its UDID:

$ xcrun simctl list | grep Booted
Related