Skip to content

device-deployment

Deploys a plugin build to Obsidian Mobile on an Android device connected over adb, for manual testing on a phone: pushes the build into a vault’s .obsidian/plugins/<plugin id>/ folder on the device, enables the plugin there, and restarts Obsidian on that vault so the new build is the one running.

Obsidian Mobile has no CLI and runs no HotReload, so the reload is a restart of the app. The restart is also what makes enabling a new plugin safe: community-plugins.json is edited while the app is stopped, so the app cannot write its own copy over the edit.

Interface Description
DeployToDeviceParams Parameters for deployToDevice.
DeployToDeviceResult What deployToDevice did.
Function Description
addPluginIdToCommunityPlugins Adds a plugin id to the content of a community-plugins.json.
deployToDevice Pushes a plugin build to a vault of Obsidian Mobile on an Android device and restarts Obsidian on that vault. The device’s vault must already exist, so the vault is one Obsidian has opened at least once. A vault in Obsidian’s app-private storage is out of reach of adb; use a vault in shared storage, such as /sdcard/Documents/<name>.
parseSingleDeviceId Picks the device id out of adb devices output when exactly one device is attached and ready.
quoteForDeviceShell Quotes a string for the device’s sh, in single quotes.
Variable Description
ADB_COMMAND The command adb is run as.
OBSIDIAN_MOBILE_APP_ID The Android application id of Obsidian Mobile.