3

For testing purposes, I would like to stop and restart my Android Wear watch face service via ADB. Stopping it appears to work normally:

adb shell am force-stop com.package.name

but starting the service back up again has me stumped. Watch faces are not activities, so it cannot be started via am start. I attempted to use the monkey command on the package, but that didn't work. I tried starting the service manually:

adb shell am startservice com.package.name/.watch_face_service

but that doesn't seem to work; either the service isn't started, or the service IS started but is not the current wallpaper.

It MUST be possible, since Eclipse manages to start the watch face when I run or debug it. But how?

2 Answers 2

3

After many days of research, I have come to the conclusion that this is impossible.

All WallpaperServices are required to require the BIND_WALLPAPER permission:

String: BIND_WALLPAPER: Must be required by a WallpaperService, to ensure that only the system can bind to it.

...which means that only the system service has the ability to start a wallpaper.

The Android operating system probably has some hardcoded voodoo magic that will automatically start any watchface installed via Eclipse or Android Studio -- that's my best guess considering neither IDE runs any ADB commands to start the wallpaper.

1
  • "The Android operating system probably has some hardcoded voodoo magic that will automatically start any watchface installed via Eclipse or Android Studio" - I'm not sure that's the case. Whenever I install any watchfaces onto my watch the face switches to the "Simple Face" as the service is stopped. I have to then manually reselect the face I am developing. Commented Mar 2, 2021 at 21:40
1

Android Studio Dolphin builds can now launch watchfaces, complications and tiles via run configurations.

For watchface it runs the following command.

$ adb shell am broadcast -a com.google.android.wearable.app.DEBUG_SURFACE --es operation set-watchface --ecn component com.example.android.wearable.alpha/com.example.android.wearable.alpha.AnalogWatchFaceService
$ adb shell am broadcast -a com.google.android.wearable.app.DEBUG_SYSUI --es operation show-watchface 
Broadcasting: Intent { act=com.google.android.wearable.app.DEBUG_SYSUI flg=0x400000 (has extras) }
Broadcast completed: result=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.