0

I have an app developed in android studio 1.4 and I am trying to see what is my best option for data storage. I want the app to work offline, so I decided on bundling it with an SQLite database. I currently have the data in a MySql database, the problem is importing the database.

I used the emulator adb tool under platform tools inside the SDK ,as explained here, to inject several tables of data and it worked fine. In only one table I have about 16000 records that are merely foreign-key references and a name (not too computationally intensive). When I copy and paste into the command line tool, for this table, it freezes. I think the tool cannot handle that much inserts. Hence I have a few concerns as I Intend to put the app onto the play-store.

  • I can use android studio to pull out the database, use an SQLite client to try inserting the bulky table, but how do I get it back on to he emulator and by extension my phone when I package it?

  • Is there a better way to manage the database? That is, when I need to push updates to the database (values only, no structural changes to tables).

  • I don't want to put the db script as a recourse in the app to add to the size of the app. Beside that, persons can simply de-compile my apk and get my db script.

Can anyone with a better understanding than I, please offer some guidance or point me to a resource that will explain about how these "in-app databases" are usually initialized and maintained?

Community
  • 1
  • 1
Faiyet
  • 5,341
  • 14
  • 51
  • 66

1 Answers1

0

Do you really need all the data at your mobile app? Is it possible that you only need part of the data depending on the user of the application?

When I came across the same issue, I served the data to the mobile application via a REST API as JSON. The mobile aplpication user may trigger the call to the API or it might run as a service.

I encountered memory issues when I tried to parse the huge JSON response. Use com.google.gson.stream.JsonReader and do not load the whole string at once.

Make sure you that this process is not executed on the UI thread.

anna
  • 585
  • 1
  • 6
  • 22