androidsugarorm

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


I want to send my sugar orm database to server, I have read send a file in Android from a mobile device to server using http and Location of sqlite database on the device but I don't know how to get the path of my sugar orm db and send it as file, I don't want to send it as json ,just send it as a file. Can anyone tell me how to send my orm database to server and what is the default path of sugar orm ?


Solution

  • Sugar ORM is based on sqlite, so the path of sugar database is the same as sqllite. For getting database path you can use:

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

    The path would be something like:

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