Storing Data on and accessing data from a website - android

This is a total noob question. Sorry in advance if it is vague, but I'm looking for advice on how to start out. I have an app that I've developed that interacts with a local sqlite3 database. Everything works great, insofar as the data is local. Now, I want to move this data away from the local device and onto my website so that the app has to call out to that URL to get/set this data.
What topics should I be looking into? I need to understand how to 1) house this data on my website, and 2) modify my app to interact with it. Again, sorry if this is vague - just looking for topics to begin my search.
Thanks!
EDIT: I'm finding lots of resources out there that describe how to retrieve data FROM the site. What I am really spinning my wheels on is how to modify data stored on a site. This is back end data. No one will ever see it directly. JSON format sounds like the way to go, but I don't know where to look for ideas of how to update this data after a user initiates a change from the app. I need to update the data on the site, not just on the local database. Thanks again!

JSON JSON JSON! JSON is awesome, and is IMO the easiest way to communicate between the web and any other platform. You can look here and here for more info on the android side. Depending on what platform you are using for your website, there are many awesome libraries to help export your info to JSON. Happy Coding!

Check out the Volley library as it will simplify and speed up greatly your network communications (get it here).
You probably want to use JSON to retrieve and send data to your web-service as it is very light and compact.
An example using Volley and JSON

Related

Parsing dota2.gamepedia.com - Android

I would like to get all information about Dota2 items I can get. Essential ones are their prices, names, thumbnail picture URLs, but other information are also welcome, like the way you buy them (for instance, you buy a Moon Shard by buying two Hyperstones).
There is a Dota2 Wiki page and there is a way to parse Wiki pages, but this didn't work. Apparently Wiki's APIs doesn't work on http://dota2.gamepedia.com.
I need this information on Android platform.
Any help?
I have actually been actively researching this same thing.
Scraping from a wiki is far too brittle (layout/website updates), why not get the data straight from valve's mouth? They have an online item viewer which consumes json item data, I was able to track down where exactly this gets published and plan on using it in a future android app as well.
The json data can be retreived via this link.
Once you have that look into something like retrofit to parse this data directly into objects.
Personally however, I would consume it through some other method and store it in your own database so your app isn't dictated by the structure of the data they push.
Hope this helps!

iOS & bootstrap connecting to external database

I am doing some investigation into developing a iOS App, Android App as well as a bootstrap website. This is really at the early stages of the project and I have been out of software development for a number of years so I am a little rusty, so please forgive me for my questions.
To connect to an external database and/or external C# code from an App, I presume you need to use a webservice? Is this the only way to do this?
What format is required? JSON?
From a bootstrap website, how would I go about doing the same thing? Via a AJAX call to a webservice?
Do most Apps use the internal storage/database for storing data? (I know that's a very general question, I am just trying to get a feel for things)
Thanks for your help.
You will need a web service. Theoretically you can connect to the databases directly with android and iOS, but that's less secure, and making changes is difficult. For example, if you ever want to rename a column in your database, you would break your existing apps. However, if you use a webservice, you can update the webservice to report the column under it's old name.
You can use whatever format you want, but I would strongly recommend JSON. There are lots of powerful, fast parsers out there to handle serializing and deserializing JSON strings out there, and some networking clients that will even handle the translation automatically for you.
You would indeed use an AJAX call.
Yes, that is very general, but most apps will. It really varies what kind of data you need to persist. If you're just looking to cache a feed until the next launch you may use a simple file storage (in iOS you can use a NSKeyedArchiver to quickly build objects into a file format and NSKeyedUnarchiver to build objects from a file), or if you need more complex data relationships you would use a SQLite database on the device. On iOS you should use Core Data to manage the SQLite store for you.
You are correct. To get data from an external database you will need to make a webservice call To a script that returns the data you wish to use.
You can get the data back in JSON or XML format. I prefer JSON as I think it is easier and simpler.
AJAX would be a good way to make calls for your data.
Its a good idea to make a mix of both. You can use and webserver to store all your data but if the user is in an area that they can't use data then it would render your app useless. Normally I keep all the data I need on a server then download and store it in the apps DB for that user. You can then make a request to the server at intervals to see if there is any new data to be downloaded. I would suggest doing a similar thing for the bootstrap site.

How to store html in database consumed by android REST web service?

I'm currently creating an android app, with java rest web service and database.
I'm quite a newbie when it comes to both android and web service development, I was just wondering if anyone could give me any tips.
I'm wanting to create a new feed within the app, similar to the facebook or sky sports. The source will be small html articles and displayed using listview; I was just wondering the best way to store the html files. The web service isn't consuming a website, instead they are just individual files.
I thought about storing them in the database and connecting that to the web service, is that a good idea? if so how would you store them correctly in a database? I want it stored as html instead of plain text due to formatting needs.
The rest of the data stored in the database will be consumed by the web service, however this will be just parsed using json.
If anyone has any tips or links that would be great, I havent been able to find any relevant information or examples.
much appreciated
There's a great SQLite Database article here -- Hope this helps!
And as for how to store it, I think parsing, as you've suggested, is a good idea -- and storing the structured information rather than just as plain text.

Android Remote Database

I'm in the process of developing an Android application that will need to connect to a central database. Users should be able to access records and add records to the database through the application. The data itself will be fairly simple with each record being made up of a number of text fields.
The database will be developed specifically for the application and only needs to be accessed through the application. Initial reading seems to indicate that a web service should be written to parse data into xml format, for use by the app.
Seen as the database is being developed from scratch, specifically for this purpose, I would like to make sure I am heading in the right direction. I have very little experience with databases and would really just like a pointer on where to start reading. Any suggestions on the format the database should take would be greatly recieved too.
Thank you
You seem to have the idea down, if it were me, I would recomend using JSON instead of XML for the Webservice, they work in very similar ways, but JSON is a lot smaller and will make the application noticeably (as in it will make a diference for the user) faster. This is specially true if you are sending large amounts of data.
Take a look at this:
GSon
If your familiar with other aspects of Java, you could make the implementation entirely server side by means of JSPs. You could access the database via the phone's browser or any other browser. If you implemented a DAO factory on the server, this would enable you to switch databases from say Oracle, to MySQL etc by means of a properties file.

Read HTML file from Website and convert into App

I am looking into developing an App that will convert a website into more readable data for an android app. I am at university and have an online notice board which can be viewed on the web but if possible I would like to transfer this into an app on android to make it more easy to read on mobile devices.
What I thinking is that the app would go to the website where the notice board is held and read in the html code to display each notice in a list adapter view. Each notice is within its own div so I assume I could use that to split each notice up into its own button on the list adapter view. Is this possible and if so how I can go about doing this. I have tried google for an answer but I have not yet found a solution to this problem.
Thanks for your help
It seems overly complicated to me. I wouldn't handle all that using Android. I'd crawl the data on a machine (server) and then I'd convert all needed data to JSON and have the Android (client) fetch the data using a simple JSON parser.
In my opinion that would be the easiest solution if you don't have access to the server the website is hosted on to get it generate a JSON feed for you directly.
EDIT: In answer to your comment Boardy.
Here is the official website of the JSON project in order to get an understanding of what it is. Then if you have access to the webserver providing that page (I assume it is a PHP based site) and want to modify or add the functionality of providing a JSON feed then you should also take a look at the PHP JSON documentation.
To parse JSON on Android check out this SO question and also don't forget to take a look at the official Android documentation on their JSON implementation.

Categories

Resources