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

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.

Related

How to store the content for android application

I'm a complete newbie in android development with some basic programming knowledge. Right now, I want to develop an E-Commerce app which allows the user to upload pictures for the public to browse through. However, I have no idea how should I store all the data, including the details(username and password) of the user, in the server. As far as I know, the database most often used in android is SQLite, but I'm not sure whether it's suitable to be used in my case.
Please shed some light. Any form of help would be much appreciated. Thanks in advance.
You could set-up a backend using some database (eg. MySQL) and some programming language (eg. PHP) as well as some kind of web-server (eg. Apache).
You would store the products,user data in tables of the database. Pictures would be stored on some directory on your server and you could store references to their path in the respective fields.
Your client (android) would load the products list as well as submit new products via issuing requests to your server back end, and perhaps store them in some SQLite database if you need the old items viewed to remain viewable without an internet connection.
A few tutorials to get you started:
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
http://www.tutorialspoint.com/android/android_php_mysql.htm
If you'll create an e-commerce mobile app, it cannot exists as a mobile app alone because it needs to connect to other users. You need to integrate it to a web service or a cloud service to tasks such as getting the item data, images, and other tasks involved. There are Baas (cloud) that you can use such as Parse and Kinvey.

which is best option to publish android app with local database?

I am developing an app in which i would need a local database.
So as per my knowledge there are two ways to do it:
First is to add pre filled database file in assets folder & make copy of local database from it the very first time app is started.
Second is using script to download it from Server for first time of app use?
First way have been pretty well answered by this guy Using your own sqlite database in android application
Can someone help how can i go with second way of download data from Server?
Should i use JSON/XML for getting that data from my Server?
Or should i go with first option since my app has only around 150 to 200 rows in the db file?
Go for the local db for the following reasons:
The users would have great on boarding experience as they can very quickly start seeing the utility of the app since you provide some data on first run without any delay that might be added when you fetch data from the server.
Do it for sure if the db doesn't increase the apk size significantly.
You must use php only if you need get information from the server, with php and json is better ...
http://www.vogella.com/articles/AndroidJSON/article.html
and if you only need share local information, only needs use MYsqLite ...
http://www.vogella.com/articles/AndroidSQLite/article.html

Best way to implement a Photosharing app

I'm doing a photosharing app with account authentication using phonegap.
We will be using jquery(client),CSS3(no-images and animation)/codeigniter(server) and we already structure our database from the server.
I can't decide how should I retrieve my data and what to do with it after I pull it from the server.
I should retrieve the data base from the login that is used it pulls out the friends/followers/people who comment to the pictures just like instagram did but it is more like a combination of facebook and instagram.
The data should be synchronized or auto update everytime there's a new comment from the photos,friend request,etc,.
Should I cache the data when I pull it from the server?What is the best way to CRUD cache data?
Generally, you can prefetch some amount of necessary data when the user log in, and you can have a background service to schedule batch transfers and batch update data. It should not automatically sync data everytime (unless you really need it), because internet connections will shorten the battery life rather quickly.
You can read this good document about this: http://developer.android.com/training/efficient-downloads/efficient-network-access.html#PrefetchData
The document is for Android, but I think it can be applied for other platforms.
Hope it help you something :)

approach for synching android app database with server db?

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

Android sync without login

I'm trying to add a synchronization function to my app which will work like this :
I want it to be login free, so no new account will be needed.
The data will be assigned to the user's google account on which he's logged in.
On server side, there will be a mySQL database wich will hold the user's data.
I didn't find a useful tutorial. http://code.google.com/p/openmobster/wiki/AndroidSyncApp This one uses some weird servlet or whatever, and the official google tut is very briefly explained.
Could anyone help me ?
I could imagine synchronization through xml - like implementing a function that would create an xml file from my database, upload it to the server and parse it/put it my online database.
This would be useful, if I only wanted to be able to modify data on one end - the phone - but then it wouldn't be called syncing, rather backup.
Or maybe I could request a similar xml file from the server. I think it should be possible to send some kind of query from the device to the server which would call a function that creates an xml file from database entries and then download the created file, parse it, compare with the device's database and update the database if some file was updated (it's 'last edited' time was changed).
So on each sync cycle I would first get the server-side xml file, update the local DB, then create the xml file from local DB, send it to the server and update the online DB. Only files with newer "last edited" time would be updated.
What do you think ?
Just for the communication between App and Server, you could use XML or JSON. But if you also want to write to the Database and/or transfer files to/from the Server, you're going to need something with Sockets.
I have the same issue.
In my case I have two separate parts to the app, one is a genreal information feed, the other is secured user data.
I need them both to sync, but the general feed needs to sync even if the user has not logged in.
There are two things I'm going to try:
1) Add the sync but don't ask the AccountManager for the token. This might skip the whole login prompt.
2) USe a separate service that can wake up and sync the general data. (I suspect this is the correct way to go).

Categories

Resources