Reputation: 18130
First, I'd like to let you know my experience.
PHP - medium | Android/Java - medium | JSON - low | MySQL - low
I'm trying to make an app that will be able to connect to a MySQL DB, grab a specified row, and display it in my application.
I've been doing a lot of research, but feel like I still have a lot of unanswered questions. From what I read that doing a direct connection to the database should never happen. Is this true? Next, most people suggest writing something in php to connect the app to the database. My main question is where do I put this php code? On a website or in the android app (if that's even possible)?
If anyone has experience with this, do you think I should follow this tutorial? (I don't want to buy a domain if I don't have to)
http://www.helloandroid.com/tutorials/connecting-mysql-database
Upvotes: 1
Views: 1787
Reputation: 5759
Create a web service to pull objects that contain data from your database. A WCF Service is a good choice.
Upvotes: 0
Reputation: 4340
Client side:
and android app that basically uses the defaulthttpclient in java to establish connection to a php page hosted on a website by posting data to it(httppost). and a json parser to read the retrieved data and display it.
server side: a php script on the web server which accepts post data from the client, and retrieves data from MySQL database at the server and displays it, which can be read by the client as an httpresponse.
i hope that helps.
Upvotes: 1