我正在使用 SymmetricDS 工具在服务器的 MySql 数据库和 Android 的 SQLite 数据库之间同步数据。我已经使用此工具从服务器获取数据并将数据发送到服务器。但我没有收到任何同步已开始和同步已完成的事件。我想显示进度对话框,直到所有服务器数据完全同步到我的表。
我无法通过他们的网站在他们的文档中找到与此相关的内容。请帮助我解决这个问题。过去 4 天我一直在处理这个问题,但尚未找到解决方案。
到目前为止我已经这样做了:
final String HELPER_KEY = "Key";
Logger.e("TAG", "Key " + HELPER_KEY);
SQLiteOpenHelperRegistry.register(HELPER_KEY, mDatabaseHelper);
Intent intent = new Intent(c, SymmetricService.class);
// Notify the service of the database helper key
intent.putExtra(SymmetricService.INTENTKEY_SQLITEOPENHELPER_REGISTRY_KEY, HELPER_KEY);
intent.putExtra(SymmetricService.INTENTKEY_REGISTRATION_URL, Constants.SYMMETRICDS_URL);
intent.putExtra(SymmetricService.INTENTKEY_EXTERNAL_ID, node);
intent.putExtra(SymmetricService.INTENTKEY_NODE_GROUP_ID, Constants.SYMMETRICDS_GROUP_ID);
intent.putExtra(SymmetricService.INTENTKEY_START_IN_BACKGROUND, true);
Properties properties = new Properties();
// initial load existing notes from the Client to the Server
properties.setProperty(ParameterConstants.ENGINE_NAME, node);
properties.setProperty(ParameterConstants.AUTO_RELOAD_REVERSE_ENABLED, "true");
intent.putExtra(SymmetricService.INTENTKEY_PROPERTIES, properties);
c.startService(intent);
最佳答案
您可以运行此 SQL 查询:
SELECT sob.status, sob.node_id, COUNT(*) as cnt, 'outgoing' AS direction
FROM SYM_OUTGOING_BATCH sob
GROUP BY sob.status, sob.node_id
UNION ALL
SELECT sob.status, sob.node_id, COUNT(*) as cnt, 'incoming' AS direction
FROM SYM_INCOMING_BATCH sob
GROUP BY sob.status, sob.node_id
ORDER BY direction, sob.node_id, sob.status;
关于java - 如何在 SymmetricDS for Android 中了解服务器同步到平板电脑的所有数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40971877/