Closed thaihuynhxyz closed 3 years ago
@thaihuynhxyz, I'm impressed by your bravery in trying to get Flutter running on a watch!
It's not actually something the SDK officially supports, though, as you can see from this issue:
@RedBrogdon , thank you for your replying. It's not the same with the Android Wear app support, as the watch face project has no Activity
. I see the way the flutter team connects a SurfaceView
with Flutter's Dart isolate in the add_to_app/android_view example, so I just want to ask in case the WatchFaceService
provide a SurfaceHolder
is it available to do the same thing without Activity context?
@RedBrogdon I did it. Just missing setViewportMetrics
. Should I add that sample to add_to_app/android_watchface
Wow. That's legitimately amazing.
You should totally add it to your sample (though make sure to attribute the clock code properly, since it's MIT licensed).
This repo wouldn't be a good place for that code to be maintained in the long run, since anything stored here is expected to be maintained by Google's Flutter team (and to be quite honest, I know nothing about Wear OS!). If you do add that code to your fork, though, I'd be happy to direct some attention to it using social media. I imagine there will be plenty of Flutter devs interested in what you've learned in building it.
We usually build watch face on WearOS with OpenGL by
Gles2WatchFaceService
. When I try the android_view sample, I have thought if Flutter can draw on aFlutterSurfaceView
, can it draw onWatchFaceService.Engine.SurfaceHolder.Surface
? It will be very productive if we can develop watch faces on Flutter instead of OpenGL.I have tried to create a
watchface
sample here.The sample runs well without error. In the logcat I see the dart isolate already executed, the
CellWidget
already init. But the watch is still black.