0

I have an Android app which handles strings with web adresses and connects to them with a webview.

Then I have a mysql db with the strings and some more information.

I've read that I should connect my app through a webservice. But if I want to store the info on the app, and only connect to the app once in the beginning when I start the app. What is the best way to go at it?

Can I store all the information from the tables into a local sqlite database? Are there any tutorials for the whole scenario. Mysql->php webservice->android app sqlite.

Best regards Joe

IAM
  • 895
  • 2
  • 13
  • 30
Joe
  • 2,675
  • 3
  • 21
  • 26

2 Answers2

1

Write a servlet (has to run on server on course) in an external dynamic web project that will handle your POST request, connect to the DB and return data. then add this data to the sqlite database, a perfect tutorial can be found here.

if you need more info on servlets, sending and getting parameters from a request, let me know

IAM
  • 895
  • 2
  • 13
  • 30
0

If you have just to "initialize" your db just, creating a whole webservice would be quite overkilling. A webservice would be very useful if you want to have your remote db synchronized with all the app (if you have "dynamic" data).

Maybe you can try to create a sql script, save it in the app and then run it to populate your db.

Here some information on how to use a script from raw folder: android, how to exec a sql file in sqlitedatabase

Hope this helps. :)

Community
  • 1
  • 1
Enrichman
  • 11,157
  • 11
  • 67
  • 101
  • what I want is to maybe update the mysql DB once a week and at the same time the users apps should update their sqlite dbs – Joe Jun 14 '13 at 12:34
  • Well, to do this you have to think about some kind of "server side". That could be a webservice or a simple text file to read. It depends on your requirements! :) – Enrichman Jun 14 '13 at 12:40