Skip to main content
Glama
ClearAppData.ts1.06 kB
import { AdbUtils } from "../../utils/android-cmdline-tools/adb"; import { BootedDevice, ClearAppDataResult } from "../../models"; import { logger } from "../../utils/logger"; export class ClearAppData { private device: BootedDevice; private adb: AdbUtils; constructor(device: BootedDevice, adb: AdbUtils | null = null) { this.device = device; this.adb = adb || new AdbUtils(device); } async execute( packageName: string, ): Promise<ClearAppDataResult> { try { await this.adb.executeCommand(`shell am force-stop ${packageName}`); logger.info("Force stopping the application successful"); // TODO: need to poll for app stopped via dumpsys // TODO: Add awaitidle await this.adb.executeCommand(`shell pm clear ${packageName}`); logger.info("Clearing app data was successful"); return { success: true, packageName }; } catch (error) { return { success: false, packageName, error: "Failed to clear application data" }; } } }

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