Test on your phone
Install the plugin you are editing on your phone over adb with wmpy push, push it again on every save with wmpy dev, and read what it prints with wmpy logs.
wmpy can put the plugin you are editing on your phone over adb. You do not
copy the file or tap through the install screen. wmpy dev sends it again
each time you save, and shows what the plugin prints in the same terminal.
wmpy device # is the phone there, and is developer mode on?wmpy push # install the plugin in this folderwmpy dev # push on every save, and follow its logwmpy logs # just the logWhat you need
Section titled “What you need”wmpy. See Install wmpy.adb, from Android’s SDK Platform-Tools. wmpy looks for it on yourPATH, in$ANDROID_HOME/platform-toolsand$ANDROID_SDK_ROOT/platform-tools, and in the folder Android Studio installs the SDK in. To use another one, setWMPY_ADBto theadbfile.- WM Keyboard on the phone, with Allow plugins on: WM Keyboard Tools Plugins Manage plugins
Connect the phone
Section titled “Connect the phone”-
Turn on Android’s developer options. On most phones: open Settings, then About phone, and tap Build number seven times. Android’s own steps cover other phones.
-
Connect the phone to your computer.
In Developer options, turn on USB debugging. Plug the phone in. The phone asks whether to allow USB debugging from this computer. Press Allow.
Put the phone and the computer on the same Wi-Fi network. In Developer options, turn on Wireless debugging and follow Android’s steps to pair with
adb pairandadb connect. -
Run
adb devices. The phone is listed with the worddeviceafter it.
Turn on plugin developer mode
Section titled “Turn on plugin developer mode”On the phone, open this screen:
WM Keyboard Tools Plugins Manage pluginsUnder For plugin developers, switch on Plugin developer mode. The phone asks before it turns it on.
Then check from the computer:
wmpy devicePixel 8 (37291FDH2004LK), Android API 35 WM Keyboard 0.6.6 is installed plugin developer mode: on plugins: allowed, 2 installed com.example.weather 1.3 com.example.cipher 2.0When developer mode is off, wmpy device says so and tells you where the
switch is. --json prints the same as JSON, and -s picks one phone.
Install it: wmpy push
Section titled “Install it: wmpy push”wmpy pushwmpy push path/to/pluginwmpy push -s 192.168.1.5:37000wmpy push checks the plugin, packs it the way wmpy pack does, and sends
it to the phone. A plugin with an error is not sent; --no-check sends it
anyway. Nothing is written to the plugin folder.
installed Weather 1.3 on Pixel 8 (37291FDH2004LK) risky permissions left off: network turn them on on the phone: Tools / Plugins / Manage plugins / Weather / PermissionsThe keyboard installs it with the same checks as the install screen. Risky permissions stay off until you turn them on on the plugin’s page. An update keeps the ones you turned on. The internet permission is the one exception: when the new version lists a website the old one did not, it waits for you again.
If the plugin’s panel is open in the keyboard when you push, the panel loads the new version at once.
| Option | Does |
|---|---|
-s SERIAL | The phone to use, when more than one is connected. wmpy device and adb devices list the serials. |
--no-check | Sends the plugin without checking it first. |
--json | Prints the phone’s reply as JSON. |
Push on every save: wmpy dev
Section titled “Push on every save: wmpy dev”wmpy devwmpy dev pushes the plugin once, then watches its folder. When you save a
file, it waits until the folder has been still for a moment and pushes again.
The plugin’s log prints in the same terminal, from the moment wmpy dev
started. Press Ctrl-C to stop.
Keep the plugin’s panel open in the keyboard while you work. Each push loads
it again, so its plugin.state starts over. What it saved with wm.storage
or persist=True stays.
When the plugin has an error, wmpy dev prints it and waits for your next
save. When the phone cannot be reached, it stops.
Read the log: wmpy logs
Section titled “Read the log: wmpy logs”wmpy logswmpy logs com.example.weatherwmpy logs --since 10mwmpy logs shows what the plugin prints and the errors it hits, with errors
in red. An error names its file and line, as in error: fares.py:3: negative fare, and the calls in your files that led there follow it, one line each,
such as at fares.py:8 in total. It reads the plugin in the current folder, or the folder or plugin id
you give. Outside a plugin folder and with no id, it shows every plugin’s
lines, each with its id. It keeps following the log until you press Ctrl-C.
--since takes 30s, 10m, 2h or 1d, or a time in logcat’s own form,
such as '11-26 14:00:00.000'.
The lines come from Android’s system log. While developer mode is on, the
keyboard writes each line there under the tag WMPlugin, as
<plugin id>: <line>. You can read them without wmpy too:
adb logcat -s WMPluginWhen the system log has nothing from the plugin yet, for example because you
just turned developer mode on, wmpy logs shows the plugin’s saved log
first. That is what it printed the last time its panel closed.
What developer mode allows
Section titled “What developer mode allows”While it is on:
- A computer connected over adb can install and update plugins without the install screen.
- What plugins print goes to the system log, where anything connected over adb can read it. A plugin that prints what you type puts that text there.
What it does not change:
- Risky permissions stay off until you turn them on on the plugin’s page. The switch Allow risky permissions still applies to all of them.
- Apps on the phone cannot use it. Only adb’s shell can, or root on a rooted phone.
- Every plugin is checked the same way as one you install from a file.
Turn developer mode off when you are done, and USB debugging or wireless debugging too. Plugins you pushed stay installed.
Without wmpy
Section titled “Without wmpy”The keyboard’s side is two adb shell content commands, so a script or CI job
can do the same. Choose any token of 8 to 32 lowercase letters and digits:
adb shell content write --uri content://com.wasimaster.wmkeyboard.plugindev/install/build0001 < Weather-1.3.wmpluginadb shell content call --uri content://com.wasimaster.wmkeyboard.plugindev --method result --arg build0001The second command prints the result as JSON inside Result: Bundle[{json=...}].
--method status lists the installed plugins, --method log --arg <id>
prints a plugin’s saved log, and --method reload --arg <id> loads an open
panel again. content write needs Android 9 or later; on Android 7 and 8,
wmpy sends the plugin in base64 pieces instead, which is slower.
Troubleshooting
Section titled “Troubleshooting”adb is not installed, or wmpy cannot find it. Install the
SDK Platform-Tools
and add the platform-tools folder to your PATH, or set WMPY_ADB.
No phone is connected over adb. Check the cable or the wireless pairing,
and that adb devices lists the phone. A phone listed as unauthorized is
waiting for you to press Allow on its screen. A phone listed as offline
needs to be plugged in again, or wireless debugging turned off and on.
2 phones are connected: say which with -s. Add -s and a serial from the
list, for example wmpy push -s 192.168.1.5:37000. Setting ANDROID_SERIAL
works too.
Plugin developer mode is off. Switch it on under For plugin developers on Manage plugins.
Allow plugins is off. Switch on Allow plugins on the same screen.
WM Keyboard has no plugin developer mode yet. Update the keyboard.
The plugin is not in the toolbox. A plugin installed with wmpy push is
in the keyboard’s Plugins tool, but it does not join the toolbox or toolbar
by itself. Add it from its ⋮ menu on Manage plugins.
Nothing shows in the log. Developer mode has to be on when the plugin
prints. Check that the plugin’s panel is open, or run the action or provider
you are testing. Wireless debugging can drop when the phone sleeps; run
adb connect again.
