Best way to send data through devices? (Android) - android

Imagine an Android app where you create a poll, you receive a poll code, and when people insert your code, they view your poll, vote on it and you receive the data.
What would be the best way to send this data and save it temporarily? Should I have an external file? A database connection? A p2p connection or anything else?
Thank you very much in advance and sorry for the dumb question I'm completely new to Android.

An Online database will work. You can store the database locally on the phone and have it refresh every "X" amount of time. You will have to use some PHP coding and query the data from the database, sending it back to the phone. You can find a free webhost that lets you store databases here . Hope this helps. Also look into importing sqlite database libraries and mysql handlers to implement this. Tweak this example on Youtube to get webhost working and a simple login via php here

Related

Regarding Database on Android

Is it possible to store data directly to the database without having the user input something in it. I am planning on creating a school updater which updates students regarding school news and such. What confuses me is that how can I store data directly into it. Im not that good on servers so Im resorting into databases but Im confused where to start.
Thanks a lot!
Do you want to store data in a remote database? If yes, you may want to use REST-APIs/Webservices and process the data on the remoteserver.
You should not (except Databases like CouchDB) connect your device directly to any remote remote device for security reasons.
Anyway, you may create a local SQLite database on your device and synchronise the data using REST.

Best way to upload /sync app/game data to server. (Android Studio)

i have created a android app with sqllite database/android studio.its like a game.i want to upload users high score details to somewhere so users can see who is the best in a app highscore table.
i already created game and sql datase.
i dont know any method to upload data.
am i want to create a server?
can i use google drive or onedrive or something?
if i can upload to data to onedrive or something,
and if i know a method to connect to it,
i can calculate other users data and make the highscore table.
thanks please help.
For this task you would need to create a server with a database holding info for all of the registered players, or if you only want to keep track of the HighScores, simply keep the top ten results. Then you would have to sync the SQLite on the device with the database on the server on every app start or exit. On start you would pull /GET/ data from the server to update your local DB, and on exit you would POST your local results to the server. Then you could chose how to implement the server whether to track all data or just check if some of the results are good enough to be in top10 and write only them.
This is a fairly trivial task.
I recommend you read about JSON in Android, HttpUrlConnection and get familiar with the basics of HTTP.
You could easily figure out the "server-side" of this task simply by rolling over few videos in the web. Hope I've helped.

Web service or direct connection to the database?

I'm new in Android Development and I want to know which is better a web service or direct connection to the database (not local database). The app will need to do alot of things with charts and etc. There is alot of information to be pull from the database. If you can give me any tips I'll be thankful.
Best Performance is to store the data from WebService in local SQLite DB: but it would be complexer
you should ask every time you start your app, if theres new data in WebService to download and store it again.
If U have a good idea about PHP,JSON you can go for it,else u can use a Direct Conncetion

How can I put my Android database onto some "central server"?

I'm actually new in the software development and wants detailed guidance here. I just have developed an android app with SQLite-Database
Now When I completed this app, the size of data of the database became very large. So now I want to put this data onto some central server
What should I do for it??
And
Is there any other feasible solution for it which would be better financially and functionally (means better performance)??
My SQLite database code will be changed or not???
Thanks,
Put your data on the server, but don't access it directly. Instead, write a webservice which you can query from your app, and which will return the necessary results to you.
It will be both easier to maintain and a more secure way of accessing your data than attempting a raw app to database connection.
You can use Google App Engine and use Google Cloud Messaging to send a receive data from the cloud... Take a look here:
https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae

Android - reading/writing to online mysql database

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!

Categories

Resources