Skip to content

Instantly share code, notes, and snippets.

LadyViktoria /
Created Apr 7, 2016 — forked from tajchert/
Android Wear Realm Database Sync

This short code will show how to sync database file using Realm, but can be used for any file that you need to send to Wear (using Data API). It just takes any file, change it to Asset object and send it over to Wear device. Also it can be used Mobile->Wear, and Wear->Mobile.

When you need to sync database just call FileSender.syncRealm(context);, that is it!

DISCLAIMER "Proper" way would be to synchronize each transaction to DB, but it in most cases Wear is used very rarely comparing to mobile, so it would most likely cause a battery drain. My idea was to synchronize it only whene it is needed (so for example when app closes). If you want to make sure that you are using latest DB, just send trigger data using MessageAPI from Wear to Phone with ask of syncing over its database, or keep some timestapm of last edit and check it.

LadyViktoria / mobile-AndroidManifest.xml
Created Mar 16, 2016 — forked from gabrielemariotti/mobile-AndroidManifest.xml
Android Wear: small gist to start an Activity on the mobile handheld from the Android Wear device.
View mobile-AndroidManifest.xml
<service android:name=".ListenerServiceFromWear">
<action android:name="" />