Closed rodydavis closed 1 year ago
The app shouldn't need to be in the foreground to work
Unless the phone app is dead then yeah that doesn't work right now
Well the watch app opens, but maybe I need to move the logic to main instead of initState on my home widget
On Wed, Feb 22, 2023 at 10:08 AM Rexios @.***> wrote:
The app shouldn't need to be in the foreground to work
— Reply to this email directly, view it on GitHub https://github.com/Rexios80/watch_connectivity/issues/6#issuecomment-1440530068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFX5GTVG5YHNJDZMLWYDWYZI2HANCNFSM6AAAAAAVEUXMLA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rody Davis Jr
I'm going to need more details on exactly what you're trying to do
What would be the recommendation here? I added a sync screen in my app to send the state manually
On Wed, Feb 22, 2023 at 10:10 AM Rody Davis @.***> wrote:
Well the watch app opens, but maybe I need to move the logic to main instead of initState on my home widget
On Wed, Feb 22, 2023 at 10:08 AM Rexios @.***> wrote:
The app shouldn't need to be in the foreground to work
— Reply to this email directly, view it on GitHub https://github.com/Rexios80/watch_connectivity/issues/6#issuecomment-1440530068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFX5GTVG5YHNJDZMLWYDWYZI2HANCNFSM6AAAAAAVEUXMLA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rody Davis Jr
-- Rody Davis Jr
If you need to send data to a dead companion app, then you should probably be using context and not messaging
So there is a SQLite database my iOS app controls and a subset small list I send to the watch.
There is a menu that a user can choose a list item on the watch and the iOS app will return a new state for the watch to render.
Imagine top level menu (playlists, songs, albums) and when they click on “songs” it returns a list of songs from the database on the phone, and when the click a song the the song details are returned from the database.
The watch never has any data other than the json passing.
I made a simple go back button that goes up a menu on the watch. Kinda doing remote driven UI
On Wed, Feb 22, 2023 at 10:11 AM Rexios @.***> wrote:
I'm going to need more details on exactly what you're trying to do
— Reply to this email directly, view it on GitHub https://github.com/Rexios80/watch_connectivity/issues/6#issuecomment-1440537071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFXYAPQNLBFFSU3T543DWYZJF7ANCNFSM6AAAAAAVEUXMLA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rody Davis Jr
Also all this is context passing, message is secondary for confirmation of receiving context
On Wed, Feb 22, 2023 at 10:15 AM Rody Davis @.***> wrote:
So there is a SQLite database my iOS app controls and a subset small list I send to the watch.
There is a menu that a user can choose a list item on the watch and the iOS app will return a new state for the watch to render.
Imagine top level menu (playlists, songs, albums) and when they click on “songs” it returns a list of songs from the database on the phone, and when the click a song the the song details are returned from the database.
The watch never has any data other than the json passing.
I made a simple go back button that goes up a menu on the watch. Kinda doing remote driven UI
On Wed, Feb 22, 2023 at 10:11 AM Rexios @.***> wrote:
I'm going to need more details on exactly what you're trying to do
— Reply to this email directly, view it on GitHub https://github.com/Rexios80/watch_connectivity/issues/6#issuecomment-1440537071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFXYAPQNLBFFSU3T543DWYZJF7ANCNFSM6AAAAAAVEUXMLA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rody Davis Jr
-- Rody Davis Jr
If you're using context what's the issue? You can read the most recent context with receivedApplicationContext
The issue is the context can only be so big so when a new state is requested and the iOS app is dead it won’t receive a new state
On Wed, Feb 22, 2023 at 10:17 AM Rexios @.***> wrote:
If you're using context what's the issue? You can read the most recent context with receivedApplicationContext
— Reply to this email directly, view it on GitHub https://github.com/Rexios80/watch_connectivity/issues/6#issuecomment-1440552828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOOFXY7YCSBXGTKYLRDKJTWYZJ3BANCNFSM6AAAAAAVEUXMLA . You are receiving this because you authored the thread.Message ID: @.***>
-- Rody Davis Jr
I see. This would require the implementation of the following: https://developer.apple.com/documentation/watchkit/wkwatchconnectivityrefreshbackgroundtask https://developers.google.com/android/reference/com/google/android/gms/wearable/WearableListenerService
I've been meaning to implement those for a while, but I haven't gotten around to it
Ok cool! Might make a PR
@rodydavis I'm working on a separate plugin to facilitate the calling of flutter code from native code, so if you put any of that logic in the PR for this just know it will most definitely change in the future
Ok I solved my problem a different way! I had a big json file to send and just chunked it over and saved it with FileManager.
Then I am using the navigation view in swift ui.
something I think that could be useful is docs on how to add the iOS and android watch targets.
There is a way to send "data" as well that isn't implemented maybe that would do what you need?
Send file might work! The file is a single JSON file and is about 1.4 MB which exceeds the context limit.
The json file is created from a minimal amount of data from the SQLite DB in the iOS app, but now I only need to sync once and the watch doesnt require the link
Maybe protobuf could reduce the size of the message
So it turns out receiving messages from the watch when the phone app is dead doesn't require anything special. It just works. @rodydavis if you listen to the message stream early enough in your app startup, you should be able to get the messages just fine.
For iOS, Android still requires a lot of work
Ok sounds good! Thinking about building wear OS directly
Closing since this was about iOS and that works. We can make a new issue for Android.
Currently have it working great, but requires the app to be in the foreground to work.
Do i need to use a background plugin to run the logic for the apple watch to communicate?