Skip to main content

Grant

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Grant an app's permissions up front, so a first-launch permission dialog never appears to block the flow. These call app_grant.

Grant​

func (d *Device) Grant(ctx context.Context, app string, permissions ...string) error

Grant allows permissions up front, so no dialog blocks the flow.

Names are cross-platform ("camera", "location", "contacts", …); "all" grants everything the app declares, and a platform name such as "android.permission.NFC" also works. On Android the result is verified by reading the state back, because pm grant reports success for permissions the app never declared.

Examples​

Grant two permissions before a flow​

if err := dev.Grant(ctx, "com.example.shop", "camera", "location"); err != nil {
return err
}