Building PHP Powered Android Applications

48,746 views

Published on

This is a talk I gave at PHP Quebec 2009 on building Android applications with PHP back-ends. Posted for completeness, the majority of this talk was buried in Android/Java and PHP code.. That said, there are still some useful things in the slides themselves to share.

Published in: Technology
1 Comment
10 Likes
Statistics
Notes
  • Android programming is done in linux, apps are written in java.
    Android programming can be done on any OS platform. :confused:open marriage
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
48,746
On SlideShare
0
From Embeds
0
Number of Embeds
422
Actions
Shares
0
Downloads
0
Comments
1
Likes
10
Embeds 0
No embeds

No notes for slide

Building PHP Powered Android Applications

  1. 1. Building PHP Powered Android Applications John Coggeshall
  2. 2. Introductions <ul><li>Welcome! </li></ul><ul><li>About me </li></ul><ul><ul><li>CTO of Automotive Computer Services (ACS) </li></ul></ul><ul><ul><li>Core PHP 5 Dev </li></ul></ul><ul><ul><li>Author, Speaker </li></ul></ul>John Coggeshall Presentation Title
  3. 3. Agenda <ul><li>Crash Course in Android Development </li></ul><ul><li>Building PHP-powered backend services for the application </li></ul><ul><li>Bringing it all together </li></ul><ul><li>Warning: Nothing Magical here! Heavy Java/Android ahead! </li></ul>
  4. 4. Server Backend <ul><li>Zend Framework Backend of web services supporting our primary Flex-powered front-end </li></ul><ul><ul><li>Supports both XML-based and Action Message Format (AMF) encodings </li></ul></ul><ul><ul><li>How Auth Service ultimately works: </li></ul></ul><ul><ul><ul><li>Post to http://server/service/v1?command=auth.find the necessary parameters </li></ul></ul></ul><ul><ul><ul><li>Receive back a success, and a session ID </li></ul></ul></ul>
  5. 5. Server-Side Service Code
  6. 6. Basic Android Concepts <ul><li>Activity – A “Screen” of your application where you do things </li></ul><ul><li>Intent – An inter-process / inter-activity notification system </li></ul><ul><li>Layout – An XML definition of widgets for an activity </li></ul>
  7. 7. The Goal <ul><li>Create an Android application that can authenticate against our pre-existing web services </li></ul><ul><ul><li>Create the Android App itself </li></ul></ul><ul><ul><li>Create a Proxy that can communicate over HTTP to the backend server </li></ul></ul><ul><ul><li>Process the XML response </li></ul></ul><ul><ul><li>Save the authenticated session for future use </li></ul></ul>
  8. 8. The Android Application
  9. 9. Considerations <ul><li>Android itself doesn’t provide too many tools for web service calls (other than a HTTP client) </li></ul><ul><li>The most challenging piece of the connectivity is in the details </li></ul><ul><ul><li>Error handling </li></ul></ul><ul><ul><li>Parsing of responses </li></ul></ul><ul><ul><li>Connecting all of it with an effective UI </li></ul></ul>
  10. 10. Another option <ul><li>As Android is entirely Java-based, there are numerous Java toolkits that can help you along the way </li></ul><ul><ul><li>Be careful, many are too bloated for Android </li></ul></ul><ul><ul><li>For XML-RPC, you can use the android-xmlrpc package </li></ul></ul>
  11. 11. If you’re going to try.. <ul><li>If you’re interested in trying the Android platform, here’s a few words to the wise: </li></ul><ul><ul><li>Find good sources of documentation </li></ul></ul><ul><ul><ul><li>Too many out-of-date / wrong articles </li></ul></ul></ul><ul><ul><ul><li>http://www.anddev.org/ </li></ul></ul></ul><ul><ul><ul><li>http://www.helloandroid.com/ </li></ul></ul></ul>
  12. 12. Development Tips <ul><li>Use the Android Debugger! </li></ul><ul><li>The Log class is great for printf() sort of things </li></ul><ul><ul><li>(Shows up in the Android LogCat tab) </li></ul></ul><ul><ul><li>Log.e(“MyErrorTag”, “My Error Message”); </li></ul></ul><ul><li>Server side: You *must* have good logging facilities </li></ul><ul><ul><li>Log exceptions, errors (real and logical) to a file you can tail –f on when making service calls </li></ul></ul>
  13. 13. Development Tips <ul><li>The AndroidManifest.xml file is very important </li></ul><ul><ul><li>Need to define everything in there to some degree </li></ul></ul><ul><ul><ul><li>Activity classes </li></ul></ul></ul><ul><ul><ul><li>Intent Filters </li></ul></ul></ul><ul><ul><ul><li>Permissions requested (i.e. Network access) </li></ul></ul></ul><ul><ul><li>Works a lot better if you use the GUI interface instead of modifying the XML directly </li></ul></ul>
  14. 14. We’re Hiring! <ul><li>Thank you! </li></ul><ul><ul><li>Interested in working on a project like this? We’re hiring! </li></ul></ul><ul><ul><li>See our full-page ad in the conference program and visit us at the Job Fair! </li></ul></ul>

×