Run Wear OS watch face as widget on phone - android-widget

Abstract
I am a Wear OS watch face developer with few existing faces.
I would like to make them available as widgets on the phone.
Ideally, I would like to package the widget with the existing face to give more value to users.
They should be able to run the watch face on the watch and the widget on the phone independently.
Background
Here is a quick glimpse of my AndroidManifest.xml entries
...
<uses-feature android:name="android.hardware.type.watch" />
...
<meta-data android:name="com.google.android.wearable.standalone" android:value="true" />
...
Mutualizing the code should not be a concern as I suspect the onDraw() signature to be somewhat similar
Question
Is this possible? If so, what would be the best approach?

There's very little commonality between the APIs for Wear watch faces and phone widgets. Widgets are built on RemoteViews (much more like Tiles on Wear OS), while watch faces are essentially live wallpapers for the watch.
I expect it would be possible to build a framework to display watch faces as phone widgets, but it would be a matter of building it yourself, from the ground up.

Related

ability to add a 3D Avatar that can be customised on a Flutter app?

I am designing an app where we would like to have a capability for users to edit their avatars style. like hair colour and body colour.
The app needs to be built on flutter, I checked out various libraries like Rive (Flare) but they do not seem to be working with 3D assets.
I came across this app called VOS which is doing something similar
Any leads will be much appreciated.
Cheers

In Flutter, how can I check if a mouse device or a touch device?

How can I check if the device is a touch device or a mouse device?
Using kIsWeb is not sufficient because if using web version of the app on a mobile device kIsWeb returns true, but I need it to return false because it is a touch device.
Checking the platform doesn't work either because if using web version of the app on an iOS device for example returns false for iOS platform check.
Use case - I have two different types of video players for my app. One is suitable for touch devices (you tap to show and hide controls) and one is suitable for mouse devices (controls show when you mouse into the player and hide when you mouse out).
Youtube has the same idea. If I use the youtube app or website on my iPhone I get touch controls. If I use the youtube app or website on my iPad Pro I get touch controls. If I use the youtube website on my Mac I get mouse controls at all screen sizes (even mobile screen sizes).
So I guess I really just need to know platform on the web. I can get platform if not on the web.
Great question #jwasher! I had the same issue - a touch and swipe based UI that was great as a native mobile app, great as an single page web app (SPA) on mobile web browsers, but that was weird and clunky for mouse based interactions when the SPA was used in a desktop web browser.
The solution I have settled on is to wrap sensitive widgets in a MouseRegion (https://api.flutter.dev/flutter/widgets/MouseRegion-class.html) to detect mouse activity at runtime, then reacting by augmenting the UI with buttons to provide a mouse focussed way of triggering actions previously only linked to touch triggers.
You could use this to "mouse-enable" individual widgets, or you could wrap the whole app in a MouseRegion, trip a state field when activity was detected then rebuild the widget tree in a substantially different way for point and click users.
This strategy may incur some minor complexity/CPU overhead on devices that will never have a mouse attached (like a smartphone), but the solution will be more flexible than a build or configuration time capability determination. If a user starts the app on a tablet, then puts it in a stand and attaches a bluetooth mouse - it will react appropriately.
A device isn't "a mouse device" or "a pointer device". Events have an input type--see Pointer event.kind--but not the whole device. A laptop can have a touch screen, and a tablet can have a stylus or external mouse; an app running in those environments can receive both types of event.
Without knowing what you are trying to accomplish with this classification, is hard to advise on how to accomplish it. Trying to style your UI based on a guess of the primary interaction mode, for instance, is a completely different problem than reacting to a mouse event differently than a touch event.

is there any way to develop first screen contents by flutter?

I'm just trying to develop first-screen contents application which acts like...
If you unlock your smartphone, this application show up and show its contents like today's whether, a sentence of bible, etc.. before smartphone's own contents. And then if you touch the screen one more time, you can use your smartphone.
So it seems like.. a splash screen of smartphone, instead an application.
Because I'm not good at English, I don't know how to call this technique by English.
So what I want to know is anything. The name of this technique.. helpful flutter widget.. or any reference about this written by flutter.
Thank you.
For Android:
You can't listen to phone unlock event after Android 8.0, see https://stackoverflow.com/a/20225681/10874380
For iOS:
I'm not very familiar with iOS restrictions, but as far as I know, apps on iOS has no way to know the phone is unlocked. Also, ios apps can't open without user tapping on it.

Transparent canvas in flutter

I would like to create an app, that works as a framework for using e.g. the ipad.
That means, that you will start the app and continue working normally with it, while suddenly e.g. animals cross the screen.
Hence the app should create a transparent canvas on top of the ipad user interface where all animations can be played.
Do packages for that exist?
Unfortunately, what you're asking for isn't currently supported in flutter. The closest you can get is notifications at the moment using a package like this
I'm assuming you want to make something along the lines of this goose desktop application for windows. Your best bet in this situation is to go native and maybe even make your own dart package.

Do screen dimensions matter when programming for Android tablet?

It's my first time programming for anything that isn't a PC. I would assume that things like screen dimensions and orientation would matter on a tablet, but in the bits of basic sample code I've found there hasn't been anything about this. Does rotating and resizing automatically happen? If not, how do I make the app full-screen?
Quick answer: yes android automatically fits your layouts to the devices screen. You can have specific layouts depending on the size and orientation of the devices. Android manages which ones to use and how to handle rotations.
When the tablet is rotated, a configuration changed event is fired. If your application doesn't state that it will personally handle this event then the android framework handles it for you. When the framework handles it, your application is killed and restarted. This allows the application to load a different layout (if you specified a different layout for landscape/portrait). The same thing happens for other configurations changes such as locale and many others.
There are two methods to make an application full screen. The first simply states the application supports a specific dpi. The following code in the Manifest supports all dpis.
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
The second method is to state that the application has been tested for and can support larger screen sizes via the targetSdk. This however, removes any compatibility features that may have existed. For example, I had an application that did some massive processing on the user interface thread, when I added the targetSdkVersion code to make my applications screen larger, the application no longer worked. This was because the targetSdkVersion not only made the screen bigger, it removed compatibility code that allowed the front end thread to do long processes. So that is your warning. Here's the code:
<manifest>
<uses-sdk android:targetSdkVersion="11" />
</manifest>
Note that the target sdk can also be 12. Here's a link to the android version and sdk number.
You can make an activity full screen by setting the theme in the xml or layout designer, for example Theme.Black.NoTitleBar.Fullscreen will give you an activity that is fullscreen.
If you rotate a device then it will use the same layout unless you have defined an alternative layout. I usually start by making a portrait layout then you can simply make a landscape version of the same layout, but for tablet you'll probably want to start landscape since that is the main orientation.
Take a look at this video it covers this and some other handy features of the layout editor:
http://youtu.be/Oq05KqjXTvs
Hope this helps get you started!