Search code examples
sqliteandroid-studiointernal-storage

Using Sqlite on Android Internal Storage


I am implementing an app with the requirements storing data private on internal storage, so the data has to be only reachable by the app itself. Actually I write the data in a file in internal storage, but I'm facing some problems to handle them.

Can I store data in an sqlite database on internal storage with it being only reachable by the app?


Solution

  • My question, can i store data in an sqlite database on internal storage, and its only reachable by the app?

    Yes.

    By default, when using a subclass of SQLiteOpenHelper the database is stored in internal storage in the App's data and thus meets the criteria of only being accessible to the App. All you have to do is supply the name of the file (the database name).

    If not using a subclass of SQLiteOpenHelper then you can use Context's getDatabasePath(databasename).