What is the best way to download .db from url and use it in my app?
Thanks for help. I was looking a lot in google but no one method helped me.
I'm using android.database.sqlite.SQLiteDatabase; and android.database.sqlite.SQLiteOpenHelper;
What is the best way to download .db from url and use it in my app?
The same way you would download anything from a URL: use an HTTP client API, such as the built-in HttpUrlConnection
or third-party libraries like OkHttp.
Download the database to a location that you get from calling getDatabasePath()
on Context
, to store it in the default directory that SQLiteOpenHelper
will use.
After the database is downloaded, you can open it using SQLiteOpenHelper
.