如何将 sugar ORM 数据库作为文件发送到服务器?

How to send sugar ORM database to server as a file?

我想将我的 sugar orm 数据库发送到服务器,我已阅读 and Location of sqlite database on the device 但我不知道如何获取我的 sugar orm 数据库的路径并将其作为文件发送,我不知道想将其作为 json 发送,只需将其作为文件发送即可。谁能告诉我如何将我的 orm 数据库发送到服务器以及 sugar orm 的默认路径是什么?

Sugar ORM基于sqlite,所以sugar数据库的路径与sqllite相同。 要获取数据库路径,您可以使用:

Context context = this; // for Activity, or Service.
String dbname = "mydb.db";
Path dbpath = context.getDatabasePath(dbname);

路径类似于:

/data/data/com.me.myapp/databases/mydb.db