I have created my first android app on my phone that contains a SQLite database. I will be the only person whoever uses this app.
I also have a SQL server database on my home PC. The SQLite database contains 4 tables that are in my SQL server database.
So I want to be able to sync my SQLite database to my SQL server database from time to time.
I have been googling how to do this and read that I need to create a web service. I have read some tutorials on this and it seems that I will be able to do this without too much hassle in .net.
My question is how do I get my android app to consume my web service? Or am I barking up the wrong tree completely?
The best thing you could do is create a RESTful API.
A rest api basically functions as a controller between your database and the client which would be your app. Your app will basically 'talk' (request) to your rest api because it wants to retrieve data from the database. The rest api then talks to the database to get the data the app wants and sends this data in a http response to the client (your app). More info on restful api's here.
In order to let your app communicate with a rest api, you need a http client. The most popular and easy to use http client is retrofit, which you can find here.
There's alot of documentation and tutorials for retrofit out there, so the rest is up to your google-fu skills.
Good luck!
Related
I want to sync my huge data in to my mobile local storage, without using Rest API web service call from server.
I have already tried once POC for rest api ws call from android mobile sqlite database sync from server using json format request and response. that time, am getting some performance issue come while huge data synchronizing from server to mobile sqlite database.thats why, searching for some other solution, without rest api, i want to sync the data from server to mobile.
Note: I have refered couchbase database for the same. it recommended for cross platform developing.
I am asking example like Firebase
any help.
Thanks Advance Guys
I have an Android application and I want to move my local database in the cloud. I decided for a SQL database and not for a NoSQL, because I want to execute complex queries. I created a database instance in RDS from Amazon and I populated the database.
Now I want to connect my mobile app to my cloud database. I saw samples for NoSQL database connection, but I wasn't able to find examples for RDS. I saw that it is recommended to create a web service and connect to that web service, but it seems much more complicated than using a NoSQL and this doesn't feel right.
Does Amazon offer some API/service for Android - RDS connection? Do you know any sample code that handles this aspect?
Does Amazon offer some API/service for Android - RDS connection?
No. AWS does not currently have an API for interacting with an RDS instance.
Do you know any sample code that handles this aspect?
You may want to access your database with PHP and get a JSON response. If your RDS instance is using MySQL then you’re in luck. There is already a lot of documentation on connecting Android to MySQL using PHP. You can get great sample code and instructions on this blog post.
Here is a very popular reference for connecting Android and MySQL.
We are interested in purchasing a server for storing a MySQL database that is used by an Android application. Just to understand, does the server only need to support MySQL, or are other requirements for a server for mobile use?
Your Android application would probably not work directly with a remote MySQL database.
In general, you would use write a web service API to act as middleware, communicating with your Android application and the database. Your Android application would make HTTP requests to the web service, which would in turn perform CRUD on your database. In this case, your server would need both a web server (with support for Java or PHP or whatever language you choose to use for the web service) and a database server. See How to have Android app work with MySQL online database?
To access the database "directly" (like it was local), this could help: MySql remote database manipulation in Android
But you might need some additional server functionality, at least in the future. Then you could use a server which also offers PHP. PHP + MySQL are usually offered together, it's very common/popular and it's cheap. Since you don't seem to have any special requirements for the server functionality, PHP is probably suitable.
I am developing social networking app on android.Rough idea of my app is that when user launches an app it will get all users of this app in near by location.So for storage purpose of users data I want to use web server. I don't have an idea what is best way to start with.Should i use Amazon web services ? (S3,Ec2) I was surfing internet got these buzz words.
Please guide me what is best approach for database storage ? Should i write my own server api ? or What ?
These are some general things you will have to do:
Buy some server space where you can host your server (this is the amazon ec2, etc). If you need a fancy domain name, buy that too, and map it to IP address of the server that you brought (optional).
Setup a db of some kind on this server to store your data (msql)
Write wrapper web services (php, jsp, etc) which will expose apis to access your data remotely. For security reasons, you should also have some authentication using some token passing mechanism.
Access the data on your server remotely using the APIs you created in the web service.
I personally favor using a MySQL database with PHP to interface between the app and the backend! Your app can send requests to PHP and then your PHP webservice would write/read to the database and then return JSON to your app.
I would say this is a very subjective question though as there as so many ways that you can write a web service.
I'm novice in android. I'm writing an android application which requires the data like comments and scores to sync with the central database. I'm planning creating a simple web service and sync the data with the app.
Please suggest me some of the best methods and technologies which i should use. Thanks!
Have a central database on a remote server.
Develop a RESTful web service to access the data.
Store the data on your local device in a SQLite database.
Communicate between both sides with good old http.
Hard to be more precise with such a vague question.