How android application synchronize data with backend server? - android

Backend server has tables, and the android client have the same tables. Are there any way to synchronize data between them?

From your question I understand that There are tables on mobile and server both are same. Now you want to take a data from server from mobile and from to Server. Use upload and Download. When your application get started download the data from the server Process on that data after that upload that data to the server. so that both your mobile and server db remain updated.
for upload and download you can use following links:
http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/
http://www.vogella.de/articles/AndroidJSON/article.html
You have to use the JSON.

Related

Convert mysql data to protobuf

I have a HTTP server to respond to the rest requests from a mobile devices. Server data won't change frequently so I am thinking to store the data inside the devices. The data is read only for the users. So I am thinking to share the whole db with the devices as a file. If I update the db, I will create this file again. When user open the application, it will check for update time from the server. If there is an update, the device will download new file. I need to convert MySql db into the Android and IOS readable file. Protocol-buffers can easily read from the both platforms. Are there any way to dump MySql data into a protobuf. Or should I use a different mechanism?

what is the best way to transfer data from android app to a database on server?

I have a game for Android device and I want to upload highscore to a server.
So far I am using url to transfer data to a php file on server which puts data to db, this is not secure as anyone can change url and make highscore .
What is the most common way to do so , is direct db connection in app secure ??
Thanks
-----edit-----
What if I want to upload large amount of data for example I want to backup sms nd contacts on a server, and I want the sms to be uploaded as soon as it arrives.
If you do not care the delay between sending data and storing to database you can use Google's GCM service. Then all the security issues are handled by Google: You send a GCM Bundle to your server via Google Cloud. But there might be a delay between sending on the device and receiving the data on the server.
Some links that will help you:
http://developer.android.com/google/gcm/ccs.html
http://javapapers.com/android/google-cloud-messaging-gcm-ccs-with-xmpp/
But you need a server with a running GCM server programm (Java but also possible in Python and even PHP).

internet database to android app

I want the users of my app to view an internet database, download some records of it into the database that is built in the app (not online db) and also to be able to upload some records to the online database.
I already have the database inside my app and my question is how can I make an online database that my android app could see, download from and upload to?
Android supports JDBC poorly - or let's be honest, not at all. Your best option is to create a Web server that wraps your database to a REST API. PHP is the most common language, while not the best, a lot of tutorials and snippets are available, so I would go with that. You'll have to wrap your database requests into HTTP requests and send it to the server.
For every query you'll plan on running, you'll have to create a PHP script that receives the HTTP parameters, builds the SQL query, and creates a structured XML or JSON response from the received data. This XML or JSON will than be sent to the Android client where you can parse it and obtain the data, do your syncing or such. I would suggest JSON, it's easier to read when debugging, consumes less bandwidth and has an easy to use parser in the Android API.
An easy lecture on PHP web service basics.
On using databases from PHP.
HTTP in Android.
JSON in Android.
Your online database should be on some server and you need to write a webservice to communicate your app to this online database(downloading and uploading purposes). your websrvice will also be hosted on some server. You then will be making webservice calls from your app to perform required modification to the online database.

Parse data from Microsoft SQL Server database to android application

My application requirement is: i have to parse data from Microsoft SQL Server 2008 to android application and as well as have to send data from android Application to server.
How to parse data from and MS SQL Server database to android app? I have done testing to send data from android app to Server.
which methods can I use? If not, is there any alternative ways to parse?
Can anyone help me? Thank you so much for reading.
Create a REST or SOAP Service with MS SQL Server as Backend. Connect to this service from your application to request or upload data. Most of those services accept and return XML data. JSON is also widely used.
Work with XML Data in Android

Android SQLite to My MySQL Web Server?

I have been learning SQLite on Android and have done some tutorials on how to use it.
There is a question that I want to ask.
Is there a way to make my app connect to my MySQL database in a remote web server of mine so that it can read data and also write data to the database?
From what I've researched, SQLite cannot be used remotely and I would need some kind of Web service in between?
It's not easy to create a connection to MySQL from Android, if it's not impossible. With that, it's also not safe if for example someone decompiles your app they have access to your whole MySQL database if you don't limit it enough.
For those reasons, you can better use a (for example) PHP webservice to which the Android application sends all their requests. An example is available at http://www.helloandroid.com/tutorials/connecting-mysql-database.
I also suggest you use Android Asynchronous Http Client so you don't have to deal with connectivity issues and AsyncTasks yourself.
You can refer to this tutorial but you do need a web-server for it.
Request mechanism
Android App ----> webserver ------> database (mysql)
Respond mechanism
Android App <---- webserver <------ database (mysql)
Android App will use JSON or other to get the data and display it
You have to use Sqlite database and web Services both. First you have to save the data in local database i.e. SQLite database and then send this data to your server using web services and vice versa.
this link for web services
and this link for SQlite will help you understand.
Thanks.

Categories

Resources