How to access online mysql database in android? - java

I have created an online database about the restaurants and I need to access this database through my android application, so that I can display the data to the users after filtering. My application does not need to update the database, but my problem is how to connect to my online mysql database and provide it to the users? I have looked on many suggestions on this site as well as on others, and I just found I have to use JSON parser while accessing but do not how to do it.

The best solution is provide a public API, managed for example with PHP, which delivers your database data filtered and displayed as your Android application needs.

This link might help you . http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Just get an understanding of JSON parsers and how it can be used in android for retrieving data from database on server... you can write webservices in php..

You need to provide a server side solution that the Android application can speak to. PHP scripts are a good way to go, that can directly interface with the MySQL database, and return results to the device.
You can then be creative with the PHP script, by sorting the results etc, and providing a more comprehensive solution by taking away some of the processing from the Android device, and doing it server side where battery life isn't as much of a problem.
You simply need to implement web service calls on the Android device, simple GET/POST requests over HTTP suffice depending on what you intend to do. Have a look into REST APIs for guidelines on how to implement properly.
You can easily add a PHP script to the same server as the MySQL database for this

Related

Sync SQLite DB on android studion with MySQL DB on web server

I am developing an android app that measures the radio interface parameters of a network periodically, stores the data in SQLite DB and transfers the data stored to MySQL DB on a web server. How can I make this possible?
I've done some research on this and found only one usable option, which is to make a web service using json or xml to pull/push data between the two databases. You could create a database link between the two, but this is not advisable.
There are numerous questions with a more detailed scope for this issue and you should be able to find one that fits your use case. If not, ask a new question after this research with more details and what you've done so far.

Collect Data from DBMS_PIPE using Java

I am currently working on a project where a lot of users will be making changes to our data and that rest of the clients are suppose to see data as soon as it updates. I have implemented web sockets to broadcasting the data the problem is we are using Oracle DBMS_PIPE as whenever data is changed in the DB now I was wondering if there is some api or some documentation which tell how to collect data from DBMS_PIPE using Java. any suggestions?
Thank you
F. Irfan

How do you get data from a server via Ruby and then pass this data into Java/Android classes?

I am making a simple todo list Android application using Ruby (Specifically ActiveRecord) to get data from a database containing Users (made up of attributes like name, emails, todo lists etc). My problem is I want to pass the User data from the Ruby to the Java/Android code (for example to load all a users information after login).
Similarly, how would I pass data from the Java/Android code back to ruby, so that it may update a users information on the database when necessary?
Please keep in mind that I MUST use ruby.
The basic idea is to get data by hitting URL on web from your mobile Android app:
You need to just create web services in Ruby that will return you data in the different formats like JSON, HTML, YAML, XML from which you can parse it on your mobile app. Usually we prefer JSON/XML formats data that will be easy to parse on mobile site.
Here you go, for creating RESTful api in Rails there are many tutorials and example are available on web like below:
Tutorials or screencasts on building a REST web service on Rails
http://pivotallabs.com/building-a-fast-lightweight-rest-service-with-rails-3/
http://railscasts.com/episodes/350-rest-api-versioning
http://gavinmorrice.com/blog/posts/21-building-a-rest-api-in-rails-3
http://codedecoder.wordpress.com/2013/02/21/sample-rest-api-example-in-rails/
http://jes.al/2013/10/architecting-restful-rails-4-api/
Ruby will go as far as serving the data to your android application. In order for your android application to be able to 'understand' the data it receives, both the server and your android application need to agree on an exchange format, in which the data is to be encoded: json, xml, yaml, or even a more sophisticated serialization framework like protobuf, if there is a compelling need to go there.
You might want to start by looking up those.

Creating Magento Site's Native Android Application

I have the following questions which I have researched a lot on Google as well as in SO but found nothing::
I have to create a Native Android Application of a Magento based Site, and I have to use the same database of Magento Site. Now, I have found that we can't Access the PHP files of the Magento project as the access is denied. So how to call a Magento Login Function from the Android Client?
I have come to know that we have to call the function through using XML-Connect file in Magento. Please any one can give me a Example how to call that file and how?
Last Parsing. Which parser would be more handy? (DOM, SAX, SIMPLE XML Serialization parser?)
How to manage the Sessions with the Magento Store So that the user can add to cart items and could do Online Transaction.
Anyone who has worked on Magento Site's App Development provide some direction to move further. I am totally lost and getting nothing from the Online Research.
Any help would be highly Appreciated.
And Regards.
I've not worked with Magento site. But I've worked with similar websites to connect to the mobile applications.
Short Answer: XML-Connect is the best way to minimize your work. And its easy to use API than connecting to the database using php files. For mobile applications, it is always advisable to use a simple xml format, however, in your case, you have to stick to xml-connect's protocol.
For some more information, see this link http://inchoo.net/ecommerce/magento/develop-your-own-magento-mobile-application/

Connect Android application to remote data

Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information:
You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages:
java.net.*
android.net.*
Like I said in my previous question, I'm still very much an android newbie, and trying to remember my java oop from college is slow. Does anyone have an example of how this might work, or how I could implement it? I wouldn't mind even connecting to a local xml file, if I could find a good example of how to do that!? Am I just looking in all the wrong places?!
Help. Please!
T
How do you plan to connect to the database?
Android allows you do to plain socket communication which you can refresh your knowledge of here:
http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/socket.html
Another method would be to put up a REST type service and respond with XML. SAX is commonly used for XML parsing in Android:
http://www.saxproject.org/
You can use SAXParser to parse XML from the net. Here's a tutorial on how to use the same.

Categories

Resources