I am writing an app for a football fanclub and wanted to ask how I can display a football table in my app with the current standings, point goal difference and so on. I will create the table on my website but I don't know how to call it in my app, and respond to the changes I make online.
Now I had two ideas but I would like to know which one would be easier and how to implement them.
Should I do it with a webview that when online shows the table from the website and when offline shows a cached version?
Or should I somehow do it with a local database?
Or suggest something that would be even better/easier?
the best practice as i do, is to make a local database for this app,
then call a webservice to get information from the server that fills the web page as xml form, finally parse the xml and insert values into your database.
Related
I'm trying to learn the best way to control the data a user sees within an application.
As an example I've set up a database that has a table for a bunch of parks that each have separate fields
DBSchema
Now I will have multiple users using this application
I don't want them to be able to see all of the parks available
I will manually create users and select which fields they see, this
will be the only way to get an account.
What is best practice when dealing with this situation? How should I set up the users table in the database in a way I can control what parks are visible to them?
I am currently exploring some possible solutions
Send a pre packaged SQLite DB with the application, and use HTTP Post
calls to alter the DB depending on which user signs in.
Store the entire SQLite DB on the server and make a call to it when a user first signs in.
I am somewhat stuck with my development at the moment because I don't know how to handle this.
The applications functionality is complete in its current state, having multiple users see something different from the same database is something I have never done and should really know.
Any tips on what I should be researching or general guidelines for this would be great.
I plan on displaying dates and times in an android application but I am stuck on how I would implement this.
My Idea:
At the beginning of every month, a new calendar is downloaded. This information is displayed within the app and no internet connection is necessary for the rest of the app usage.
The information is in the form of an html table. How can I import this table, and display it within the App (also allowing the user to view only certain information in the table (querying the table))
Do I have to import this table into an sqlite database? or is there a less complicated way of doing this. I would like to limit the number of times the user has to access the internet, therefore it would be necessary to store the html table within the app itself.
How about save the table as an xml file? With the xml information you can query, or handle the data as array or list
Can you create a way to access your data in a more "friendly-way"? For example you could create an endpoint online where the app will send a request, download the JSON and save that in a internal database (SQLite, check this if you don't know how).
Or, the ugly way would be to parse the table in the device using Jsoup (which you tagged). Then it's the same, you should save it in a database and read the data from there.
By the way, I would not store directly the html table, because then you will need to parse it every time you need something (p.s it will be slow)
I'm developing an Android app as a "proof of concept" for our company. If they like it and think it's worth investing, then we'll move on to bigger things. I'm trying to figure out the best/most practical approach for this.....the basics of the app will connect to our DB and display information regarding a specific customer. For now, let's say we will only pull data from 3-4 tables (but there could be 10+ in the future). If the app doesn't have an internet connection then it should use the local DB. What is the best approach for this? Here's what I was thinking and would like some input/suggestions if possible:
1.) app runs checks internet connection. If exists, check db version (how, through a web service?)..if server db is newer, get latest data. If no internet, use local db.
2.) app parses data and displays it.
If this is correct, then there could be no modifications to the web service that would add fields to a result without changing the app as well. Is there a way for an app to parse fields regardless of how many fields there are?
I've read and walked through the tutorial on google with databases and such (Notepad tutorial) but it seems like the column names are all hard-coded in the parsing class, which I was hoping to avoid.
Sorry if this is confusing but I know I need my app to use a local db to read data, I also know that the app must get data from the server when it can (via onCreate or a refresh button) and copy it locally....Copying it locally is the part I'm having trouble understanding I guess....is there no way of saying "go out and get this result and display it", knowing that those results could mean 5 fields the first time or 1 the next.
Any help/guidance is greatly appreciated!
You probably want to use a SQLLite DB to store your data locally, a ContentProvider to provide CRUD access to the db, and a SyncAdapter to sync with your server when possible. The Sync Adapter also writes to the DB via the ContentProvider. See the SampleSyncAdapter sample in the SDK for an example of how this works. You will be implementing your own ContentProvider, but the sample just uses Android's supplied Contacts ContentProvider.
http://developer.android.com/resources/samples/SampleSyncAdapter/index.html
I'm building an android game, and when finishing the game the user can insert his name on the highscores table.
The highscores table is a table in a SQLite DB that is stores in the device as part of the game.
What i'd like to do is to store this information online, so the user can choose between see the global highscores table or only his local highscore table. The local part his done.
But what do I need to create the global highscore table?
Create a DB online?
How to update and select it from android?
I read about webservices,I only need to maintain a table with 4 fields what is the simplest way to do this?
Which api should I use : Rest ful api would be good option or Http Client-server
Thanks in advance,
-To make global high-score table, u gonna need online database.
-To update and select record, I use php script to do that job, like api for my own app. You can use xml parsing to send and receive data. Here is some nice tutorial for android xml parsing.
http://www.ibm.com/developerworks/opensource/library/x-android/
http://p-xr.com/android-tutorial-how-to-parseread-xml-data-into-android-listview/
Hope this can help =)
To update in online data base ,you have to use webservice .
Send data(Highscore and other parameter) by appending to webservice on
finishing of of game
You can maintain table on online server, and when you post data,then it will
return allready made high score in responce.
Get responce and show it in user interface
This is the way to store data to online database ,i have developed an app that doing same thing.
I've just written a short Android app which stores userdata in the phone-side sqlite database.
What I'd like to be able to do is to add this to an online database (I currently have a mysql database with my webhosts, but if there's any easier way then I'm open to suggestions), but it'll be subject to condition (Such as if a certain value doesn't already exist). I'd also like to be able to get data from this online database too to be added to the sqlite database on the phone.
I've had a look around and people seem to suggest using php as a go-between for that, but is that the easiest way? there aren't any mysql helper classes that could just interface directly or anything?
Newbie question I know, but the project was to teach myself how Android works so getting stuck in is the way to go..
Cheers!
Yes; using PHP is an example of an easier way to go. You need to create web services which allow you to interact between the android phone and a MySQL database. To my knowledge you can't go directly to a database hook; as you need to have something that can hook in. Also it would be a security issue if you put on each and all of your phones the connection information for your database.
Think if you had to change the host of your DB as your traffic grew large that you needed to upgrade; this would be a new update in the store and all clients would need to update this; otherwise you would be maintaining two code bases.
By using PHP you are able to create that middle level and easily interact with the DB.
Here is a quick article on creating REST PHP Web Service. Tutorial
Good Luck!