Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 679 Bytes

detect-maestro-in-your-app.md

File metadata and controls

17 lines (13 loc) · 679 Bytes

Detect Maestro in your App

It's sometimes useful to be able to add logic in your app that depends that whether you are running within the context of Maestro. In order to detect Maestro, check to see whether the Maestro-specific port is open on your device:

PlatformMaestro Port on Device
iOS22087
Android7001

Here's an example of how to check for Maestro in an Android app:

fun isMaestro(): Boolean {
    return try {
        Socket("localhost", 7001).use { true }
    } catch(ignored: IOException) {
        false
    }
}