matanlurey matanlurey - 1 year ago 68
Android Question

Android lock-screen Widget in Flutter?

Cross-posted from /r/dartlang on Reddit:

I saw the Flutter/Dart Google IO presentation and decided I wanted to make a stupid silly Android app. It was pretty easy to get started, but I couldn't find anywhere on how to do a simple lock-screen widget.

Basically I just want an app that periodically polls a JSON API and displays some data on the android lock screen. Is this possible to do with Flutter at the moment?

Disclaimer: I'm an infrastructure/backend python/golang developer who has never written anything close to a mobile app.

Answer Source

App Widget layouts are based on RemoteViews, which do not support many types of view widgets. Because FlutterView extends SurfaceView to get access to low-level graphics APIs, it can't be embedded in an app widget.

To quote CommonsWare: "At best, you can try to write your own home screen implementation that does this." But that is a much bigger project than you probably had in mind.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download