27
Mar

How to get UDID of iOS device

Following code snippet demonstrates how to capture UDID for iOS device:
———————————————————————–

public ArrayList getIOSUDID() throws InterruptedException {
try {
String getIOSDeviceID = commandPrompt.runCommand(“idevice_id –list”);
String[] lines = getIOSDeviceID.split(“\n”);
for (int i = 0; i < lines.length; i++) { lines[i] = lines[i].replaceAll("\\s+", ""); deviceUDIDiOS.add(lines[i]); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return deviceUDIDiOS; }