Skip to main content
Glama

enableDemoMode

Configure device status bar indicators for consistent screenshots by setting time, battery level, signal strength, and notification visibility.

Instructions

Enable demo mode with consistent status bar indicators for screenshots

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeNoTime to display in statusbar in HHMM format (e.g., 1000 for 10:00)
batteryLevelNoBattery level percentage (0-100)
batteryPluggedNoWhether the device appears to be charging
wifiLevelNoWiFi signal strength (0-4)
mobileDataTypeNoMobile data type to display
mobileSignalLevelNoMobile signal strength (0-4)
hideNotificationsNoWhether to hide notification icons
platformYesTarget platform

Implementation Reference

  • The enableDemoModeHandler function that executes the tool logic by instantiating DemoMode and calling its execute method with the provided arguments.
    const enableDemoModeHandler = async (device: BootedDevice, args: EnableDemoModeArgs) => { try { const demoMode = new DemoMode(device); const result = await demoMode.execute(args); return createJSONToolResponse({ message: "Demo mode enabled", observation: result.observation, ...result, demoModeEnabled: true }); } catch (error) { logger.error("Failed to enable demo mode:", error); throw new ActionableError(`Failed to enable demo mode: ${error}`); } };
  • Zod schema defining the input parameters for the enableDemoMode tool.
    export const enableDemoModeSchema = z.object({ time: z.string().optional().describe("Time to display in statusbar in HHMM format (e.g., 1000 for 10:00)"), batteryLevel: z.number().min(0).max(100).optional().describe("Battery level percentage (0-100)"), batteryPlugged: z.boolean().optional().describe("Whether the device appears to be charging"), wifiLevel: z.number().min(0).max(4).optional().describe("WiFi signal strength (0-4)"), mobileDataType: z.enum(["4g", "5g", "lte", "3g", "edge", "none"]).optional().describe("Mobile data type to display"), mobileSignalLevel: z.number().min(0).max(4).optional().describe("Mobile signal strength (0-4)"), hideNotifications: z.boolean().optional().describe("Whether to hide notification icons"), platform: z.enum(["android", "ios"]).describe("Target platform") });
  • Registration of the enableDemoMode tool in the ToolRegistry using the schema and handler.
    ToolRegistry.registerDeviceAware( "enableDemoMode", "Enable demo mode with consistent status bar indicators for screenshots", enableDemoModeSchema, enableDemoModeHandler );
  • Core implementation of demo mode enabling in the DemoMode class's execute method, which sends specific ADB commands to configure the Android status bar.
    async execute(options: DemoModeOptions = {}): Promise<DemoModeResult> { const { time = "1000", batteryLevel = 100, batteryPlugged = false, wifiLevel = 4, mobileDataType = "4g", mobileSignalLevel = 4, hideNotifications = true, } = options; try { // Get current package name from active window const activeWindow = await this.window.getActive(true); logger.info("Setting up Android demo mode for current app:", activeWindow.appId); // Allow demo mode await this.adb.executeCommand("shell settings put global sysui_demo_allowed 1"); // Enter demo mode await this.adb.executeCommand("shell am broadcast -a com.android.systemui.demo -e command enter"); // Set battery status await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command battery -e plugged ${ batteryPlugged ? "true" : "false" } -e level ${batteryLevel}` ); // Set clock time await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm ${time}` ); // Handle notifications if (hideNotifications) { await this.adb.executeCommand( "shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false" ); } // Set network status await this.adb.executeCommand( `shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level ${wifiLevel} -e mobile show -e datatype ${mobileDataType} -e level ${mobileSignalLevel}` ); logger.info("Demo mode setup completed successfully"); return { success: true, message: "Demo mode enabled successfully", demoModeEnabled: true, packageName: activeWindow.appId, activityName: activeWindow.activityName }; } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err); logger.error("Failed to set up demo mode:", err); return { success: false, error: `Failed to set up demo mode: ${errorMessage}`, demoModeEnabled: false }; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zillow/auto-mobile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server