Reputation: 1712
my client has a simple SQLite DB exposed through an URL (direct download of the DB entire file).
What I have to do is to download the file and then use it in my app: Android and iOS.
I am already able to use the same DB locally: I have a copy of the same file that is online (not updated) in my assets and resource folders and I can use the data in it inside my app. The DB structure won't change; the file is updated every night to reflect the changes in their DB, so only record updates/additions/removals.
Anyone can give me any advice on how to achieve this result?
Upvotes: 1
Views: 1511
Reputation: 16652
Since you already have a url of this data file, then you need to separately download this file and save it to local on each platform, and use DependencyService
to call the method of each platform in your portable lib.
For the example of using DependencyService
, you can refer to Saving and Loading Files.
For the downloading part, you can use some plugins for example like CrossDownloadManager, which may make your work easier.
Or if you want to complement this work in your PCL, you can add a System.Net.Http
reference in your PCL, then use HttpClient
to download your database file, but you still need to use DependencyService
to save this file on different platforms.
Upvotes: 3