Php Website and Android Application
dear all, i am a beginner in android
i have a website that contains forms and send mails using PHP, also at the same time the data will be saved into my database.
and at the same project i have a login form with username and password which check my database and if the username and password matches changes will appear in home page
my problem is that i need to make android application for my php website
i want to know what is the best way to make this application??
i want to use my php website as an application like facebook application.. but i dont know how.. can u put me in the right way coz i am a beginner in android
06-25-2012 05:11 AM
Building an Android web client
It looks like you're wanting an Android client to interact with your website. You can do the job with some mixed Java/PHP code.
1 On the server you need an AJAX-style handler that will decode an HTTP request, do something with it and send back a plain text response using print.
2 On the phone you need to build your GUI and get it ready to make queries and present the data that comes back.
3 Also on the phone you need a worker class that takes queries from the GUI and builds an HTTP request. It sends off the request and waits for a response. Then it decodes what it sees and calls back to the GUI to do something appropriate. I have sample code that does this if you need it.
You'll want to devise a simple "language" that suits the needs of all the different things that have to be done. Such as sending in a login request or asking for a particular database record. I do it with a single word command/request keyword, then a space, then a URL-encoded message (to allow spaces and other troublesome characters). The receiving end in both directions decodes the message and calls a handler depending on what the command word was.
Debugging the server can be a little tricky but you can paste a complete request into your browser and see what comes back. At the start it'll mostly be PHP errors...
Last edited by Tramontana; 08-07-2012 at 02:24 PM.