Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 643 Bytes

detect-maestro-in-your-app.md

File metadata and controls

20 lines (16 loc) · 643 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:

Platform Maestro Port on Device
iOS 22087
Android 7001

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
    }
}