Skip to content

Commit

Permalink
Merge pull request #1714 from flexn-io/cherry-pick_fix/choosing_andro…
Browse files Browse the repository at this point in the history
…id_device

Cherry pick fix/choosing android device
  • Loading branch information
pauliusguzas authored Sep 20, 2024
2 parents 10be8c7 + 29a2a1a commit 6ef44a1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/sdk-android/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ export const getAndroidDeviceToRunOn = async () => {
}
logDebug('Target not found, asking where to run');
return askWhereToRun();
} else if (activeDevices.length === 1 && device) {
logDebug('Device provided', device);
if (_isString(device)) {
if (foundDevice) {
if (foundDevice.isActive) {
return foundDevice;
}
}
return askWhereToRun();
}
const availableDevice = activeDevices[0];
logInfo(`Found device ${availableDevice.name}:${availableDevice.udid}`);
return availableDevice;
} else if (defaultTarget) {
// neither a target nor an active device is found, revert to default target if available
logDebug('Default target used', defaultTarget);
Expand Down

0 comments on commit 6ef44a1

Please sign in to comment.