[英]How to transfer SQLite DB from handheld to wearable?
I have an app with 2 modules: 1 for an hanheld and the other one is for a wearable. 我有一个包含2个模块的应用程序:1个用于手持设备,另一个用于可穿戴设备。 I have the DB on my handheld module and I need to copy it somehow to the wearable.
我的手持模块上有数据库,我需要以某种方式将其复制到可穿戴设备上。 My DB is really small, it contains only strings so it shouldn't be a problem to copy it.
我的数据库很小,只包含字符串,因此复制它应该不是问题。
At first I tried to use a shared DB for both modules (with a singelton class) but without luck, each module saw a different DB no matter what I did. 最初,我尝试为两个模块(具有singelton类)使用共享DB,但是没有运气,无论我做什么,每个模块都看到了一个不同的DB。 My second attempt was to send it through the data layer from the handheld to the wearable but I`m not exactly sure how to do it and in addition I saw that I need to export my DB to a file each time and it seems a bit too complicated.
我的第二次尝试是通过手持设备的数据层将其发送到可穿戴设备,但是我不确定该怎么做,此外,我看到每次都需要将数据库导出到文件中,这似乎有点太复杂。
Please try to help me figure out what is the best solution. 请尝试帮助我找出最佳解决方案。
Handheld: 手持式:
table
and put them into DataMap
object table
选择所有行并将其放入DataMap
对象 DataMap
object using DataApi
DataApi
发送DataMap
对象 Wearable: 可穿戴:
receive the DataMap object using DataApi
delete all rows from the table and insert the received.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.