Repository navigation
feat: pass arguments and environment variables to apps launch - #531
Open
mobile-kevin wants to merge 2 commits into
Open
mobile-kevin wants to merge 2 commits into
mobile-kevin wants to merge 2 commits into
Conversation
apps launch takes repeatable --arg and --env KEY=VALUE flags. On a real iOS device they go through ProcessControl, on a simulator as simctl launch arguments and SIMCTL_CHILD_ variables. Android has no app arguments or environment, so both are rejected there. The device.apps.launch JSON-RPC method accepts the same as args and env.
Each --arg on Android must be key=value and becomes am start --es key value, which the app reads from its launch intent. An argument without '=' is an error. --env stays iOS-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds launch arguments and environment variables to
apps launch, for the "App launch options" roadmap item (mobile-next/mobile-mcp#370).--argcan be repeated.--env KEY=VALUEcan also be repeated. Values may contain=or be empty.LaunchAppWithArgs).simctl launch, and env vars are passed asSIMCTL_CHILD_<KEY>.--argmust bekey=valueand becomes a string intent extra,am start --es key value. The app reads it from its launch intent (getIntent().getStringExtra("key")). An argument without=is an error.--envis an error because Android apps have no environment.device.apps.launchJSON-RPC method acceptsargs(string[]) andenv(object).RemoteDeviceforwards both.Testing
simctlLaunchArgs,simctlLaunchEnv,launchExtras,launchArgswith extras,parseLaunchEnv, and the Android rejections.ps ewwon the launched Settings process shows-AppleLanguages (he)as arguments andFOO=barin its environment.--arg "mcpFlag=hello world; echo pwned"succeeds, anddumpsys activityshows the intent(has extras). The value stays one shell-quoted word.--arg -FeatureXis rejected.Summary by CodeRabbit
key=valueintent extras.key=valueformat.=sign.