0

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!

6
  • The application I reference written in php is just over the internet on my computer Commented Jul 9, 2012 at 15:40
  • I'm sure PHP could be installed on an android device, however Java is what Android is based on and by using PHP you'll be making it harder to take advantage of the APIs they provide. Alternatively consider an HTML5 based on something like PhoneGap phonegap.com Commented Jul 9, 2012 at 15:40
  • The API is not an Android API. Its an API I've developed for custom usage. Much like when a user wants to use imdb, they have to contact their API Commented Jul 9, 2012 at 15:41
  • 1
    I was referring to the APIs provided by Android to hook into the phone's functionality - they're fairly important when developing a mobile app with any complex functionality. Def checkout things like PhoneGap if it's just a simple app. Would also mean you could port to other platforms. Commented Jul 9, 2012 at 15:42
  • Can html, css, or javascript contact an API though? and then parse an xml response? Commented Jul 9, 2012 at 15:47

3 Answers 3

1

There are several options i found:

  1. http://phpforandroid.net/
  2. http://www.talkandroid.com/6211-php-for-android-install-it-and-start-testing/

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.

Sign up to request clarification or add additional context in comments.

3 Comments

I'm intrigued by phonegap. I have yet to hear about it. My concern though is, if I can only utilize html, javascript, and CSS, I may not be able to contact the API and parse the xml response. Perhaps I'm unaware of such functions for html, javascript, or css?
and can phonegap apps be placed into apple and android app stores?
Regarding the first question: using javascript ajax calls you can contact your php and parse the response, but I'd recommend Json and not XML, and use jquery/jquery mobile as well. Phonegap apps after compilation, are exactly like any other app and can be placed on android/apple stores.
0

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).

1 Comment

The web application I have now is just on my local computer. Its unpublished and such. It contacts the API via internet however. If I simply move all the necessary files to my android, are you saying it should still work with the browser I have loaded on my device?
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.