I need some help, my app created a database on creation at the minute.
What I want is to get the information in a database on a server or PC and load it into my app. It just needs to be from server to app, not back again.
I have no idea how I would do this, does anyone have any ideas?
first, I should say that your question is so wide. It contains alot of technologies. So, I'll give you a brief walk through here. you should figure out the rest on your own. and then, you can come back and ask more specific questions.
That said, here is the path you should take:
example: http://your.server.com/api/somedata
calling this url with
GET
method should return the data you want in JSON format.
String
.If you are the one developing the server api, then this book is a recommended reading:
##Update## Say you have a table in your server database called (TABLE) with the columns COL_1, COL_2, COL_3.
You could implement a php page called 'TABLE.php' that return the following:
{
"items": [
{"COL_1": "value_1", "COL_2": "value_2", "COL_3": "value_3"},
{"COL_1": "value_2", "COL_2": "value_3", "COL_3": "value_4"},
{"COL_1": "value_4", "COL_2": "value_5", "COL_3": "value_6"},
...
]
}
In your android application call http://your.server.com/api/TABLE.php
page with GET method, parse the JSON returned (above) and save it to your local database.
You can do this for each database table on your server, until you have all your data saved locally in your android application.
This probably wont be the best design decision, but considering your knowledge about the topics, this could be a fair starting point.