Q:

How to sync SQLite database between phone and watch?

I am working on creating a wear module for my SMS messaging app. I store the messages in a custom SQLite database on the phone. I am unsure if there is a good way to the database itself, or if it would make more sense for the watch to just ask the phone for the messages when the watch app is opened. It may be smarter to just ask for the messages, but I am not sure what type of structure would be best for communicating between the phone and watch. (I am restricting this app to only Android Wear 2.0)
Thanks in advance!

A:

You can just follow Sending and Syncing Data document:

The MessageApi class can send messages and is good for remote procedure calls (RPC), such as controlling a handheld's media player from the wearable or starting an intent on the wearable from the handheld. Messages are also great for one-way requests or for a request/response communication model.

As stated in this tutorial, it is the simplest way we can pass information to and from a Wear device. 

Google describes the MessageApi as “a one-way communication mechanism that’s meant for ‘fire-and-forget’ tasks”. This is opposed to Wear’s DataApi, which is meant for more long-term syncing between a Wear device and a phone/tablet.

There is a sample code in the tutorial that consists of two pretty obvious steps: sending a message to a device, and recieving a message from the sender. In this example, you will send a message from our Wear device to the phone it is paired with, and display a Toast on the phone as a result.
On your syncing part, you can create a function when and how your mobile and wear device will communicate and call Message API to send and receive messages. Also try checking syncing data items, if you'll be sending a blob of data to your android wear.

