Reputation: 1362
I've been researching writing applications with Android and have begun development in Java. However, I have already written an application which works successfully using a combination of php and html (utilizing http post for a search utility), which then contacts an API.
I have read that PHP can run on Android, but is this only if the user installs something special? Or does it now come standard on Android phones?
Secondly, if not, I've heard of simply creating a web application. Is there a way I can use my already working php code with my Android? or will I have to customize it in some way.
Any light on this subject would be great. I can't find consistent answers!
Upvotes: 0
Views: 1744
Reputation: 51
You can use your existing functions written on PHP just pass the values as jSON data.
Then on your Android application all you need to do is parse the jSON data that could be passed via GET or POST depending on your need.
so technically, you'll need to understand PHP as server-side scripting language, pass the data as jSON as its the lightest weight data interchange format that could be parsed by JAVA which is the base of android apps.
Upvotes: 0
Reputation: 17940
There are several options i found:
Please note that i have not used these frameworks and have no idea how good they are.
Another option is develope in java and make HTTP calls to the php in certain occasions when needed.
One more option, is phonegap which allows you to develope android application using HTML,Javascript,CSS but that will require some changes to your existing application.
Upvotes: 1
Reputation: 4668
If you already have a working web application you can just access that with your android device. Maybe adapt the layout to fit well onto the smaller screen.
Without further work you cannot run PHP on an android phone, as you would need an interpreter (commonly a webserver).
Upvotes: 0