admin管理员组文章数量:1391929
I am making a simple wearOS app, which counts reps for different exercises in a session. I want to be able to see the different sessions on a mobile app, but I am having trouble figuring out what how to set it up. Both in terms of storage and synchronization between devices.
As a quick example, I might have a session on 01/05/25, where i do:
- squat: 25
- deadlift: 25
- bench press: 25
All of which are kept track of on my watch with a simple counter, which has a + and - button.
I want to save the data locally on my watch no matter what. It seems like I should be using Jetpack Datastore here. But how do I synchronize the data to my phone?
I know it depends on whether I am making a standalone or non-standalone app. I am thinking in the case of just wanting to share some counter integers, it makes sense to have a standalone app. Please correct me if I'm wrong.
Should I be using Datastore on the watch and then use something like Wearable Data Layer API to sync the data between mobile and watch, whenever they are connected?
Or does it make more sense to use a cloud storage, like AWS, to upload the data to the cloud and synchronize the devices independently of each other?
Or is there another, better way of doing it?
Finally, I am in doubt of how to implement this into an MVVM architecture, if that even makes sense. So if someone has some guidance on that as well, I would appreciate that.
I hope it all makes sense. I am happy for github examples as well, but would like something very simple, as I am still new to the whole Android development and MVVM architecture.
I am making a simple wearOS app, which counts reps for different exercises in a session. I want to be able to see the different sessions on a mobile app, but I am having trouble figuring out what how to set it up. Both in terms of storage and synchronization between devices.
As a quick example, I might have a session on 01/05/25, where i do:
- squat: 25
- deadlift: 25
- bench press: 25
All of which are kept track of on my watch with a simple counter, which has a + and - button.
I want to save the data locally on my watch no matter what. It seems like I should be using Jetpack Datastore here. But how do I synchronize the data to my phone?
I know it depends on whether I am making a standalone or non-standalone app. I am thinking in the case of just wanting to share some counter integers, it makes sense to have a standalone app. Please correct me if I'm wrong.
Should I be using Datastore on the watch and then use something like Wearable Data Layer API to sync the data between mobile and watch, whenever they are connected?
Or does it make more sense to use a cloud storage, like AWS, to upload the data to the cloud and synchronize the devices independently of each other?
Or is there another, better way of doing it?
Finally, I am in doubt of how to implement this into an MVVM architecture, if that even makes sense. So if someone has some guidance on that as well, I would appreciate that.
I hope it all makes sense. I am happy for github examples as well, but would like something very simple, as I am still new to the whole Android development and MVVM architecture.
Share Improve this question asked Mar 14 at 4:58 theproductivepickletheproductivepickle 739 bronze badges1 Answer
Reset to default 2I want to save the data locally on my watch no matter what. It seems like I should be using Jetpack Datastore here
Yes, but see this note:
If you need to support large or complex datasets, partial updates, or referential integrity, consider using Room instead of DataStore. DataStore is ideal for small, simple datasets and does not support partial updates or referential integrity.
it makes sense to have a standalone app
Yes, that's the general recommendation, and it doesn't look like in your case, the phone is needed to increase/decrease counters:
We recommend that Wear OS apps work independently of a phone so users can complete tasks on a watch without access to an Android phone
Should I be using Datastore on the watch and then use something like Wearable Data Layer API to sync the data between mobile and watch, whenever they are connected?
Or does it make more sense to use a cloud storage, like AWS, to upload the data to the cloud and synchronize the devices independently of each other?
Yes, Wear Data Layer API will take care of "synchronize the devices independently of each other whenever they are connected" for you:
Data is transferred in one of the following ways:
- Directly, when there is an established Bluetooth connection between the Wear OS device and another device.
- Over an available network, such as LTE or Wi-Fi, using a network node on Google's servers as an intermediary.
More resources on this:
- Sync data items with the Data Layer API
- Wear OS samples - DataLayer
- Horologist DataLayer library
if someone has some guidance on that as well, I would appreciate that
- Guide to app architecture
- Architecture MAD Skills
- Deep dive into Wear OS app architecture
本文标签: databaseStore data and synchronize between android phone and watch appStack Overflow
版权声明:本文标题:database - Store data and synchronize between android phone and watch app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744673268a2618955.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论