1. Mobile apps with JavaScript and PHP
Ed Finkler
Fictive Kin
@funkatron
http://funkatron.com
http://joind.in/3389
Thursday, May 26, 2011
2. Me
• I work on Gimme Bar (http://gimmebar.com)
• I work on Spaz (http://getspaz.com)
• Sometimes I write PHP, sometimes I write JavaScript
Thursday, May 26, 2011
3. Why JavaScript?
• Offers the best option for cross-platform mobile dev
• strong, diverse community, good tools
• deployable from server or locally-installed
Thursday, May 26, 2011
5. Strong webkit implementations on most platforms
• iOS
• Android
• webOS
• BlackBerry
• Symbian
Thursday, May 26, 2011
6. Deploy on server:
• limits your access to device functionality
• far easier to update
Thursday, May 26, 2011
7. Deploy on device
• access more platform-specific functionality
• updating can be a pain
Thursday, May 26, 2011
8. Shim libraries bridge JS and device functionality
• HP Palm webOS special case – all apps build on JS/HTML/CSS
Thursday, May 26, 2011
9. Options for device deployment
• PhoneGap
• Titanium Mobile
Thursday, May 26, 2011
10. PhoneGap
• Wrapper + shim layer – very basic, works on several platforms
• Much more flexible; lets you pick any approach for building the app
• Potentially slower; less access to platform-specific APIs
• http://www.phonegap.com/
Thursday, May 26, 2011
11. PhoneGap device API support (varies by device)
• Accelerometer • Geoloc
• Camera • Media
• Compass • Network connectivity
• Contacts • Notications
• Device Info • Storage
• Native Events • Plugins can add additional
https://github.com/purplecabbage/
• File phonegap-plugins
Thursday, May 26, 2011
12. PhoneGap + Your preferred approach
• Lots of JS DOM frameworks work well in PhoneGap
• jo (http://joapp.com)
• jQuery Mobile (http://jquerymobile.com)
• Enyo (http://developer.palm.com/)
• Sencha Touch (http://www.sencha.com/products/touch/)
• Many more!
Thursday, May 26, 2011
13. Titanium Mobile
• Full-stack, access to native UI components via JavaScript. Works on Android
and iOS.
• Potentially faster
• Anecdotally, can be kinda buggy
• http://www.appcelerator.com/
Thursday, May 26, 2011
14. Titanium Mobile device API support
• Similar base support to PhoneGap, plus
• Android Calendar
• Facebook APIs
• Map
• XML
• Yahoo APIs
• Plugins can add additional functionality; can be written in native code
Thursday, May 26, 2011
15. Spaz in Enyo
• Dev in Chrome
• Test with emulator VM
• We can build really fast with this
Thursday, May 26, 2011
16. Server Side: PHP
• You can build your server side stuff lots of ways
• Pick what works for you and STFU
• Some simple FWs
• koi
• slim
• breeze
• limonade
• glue
• flight
Thursday, May 26, 2011
17. RESTful implementations with JSON responses
work best
• Make a simple HTTP call w/ basic query data
• respond with JSON structure
• https://www.ibm.com/developerworks/webservices/library/ws-restful/
Thursday, May 26, 2011
18. FRAPI
• A great framework for rapidly building RESTful APIs
• Using it at Gimme Bar
Thursday, May 26, 2011
19. Examples!
• WildGarlic
• in Jo
• in jQueryMobile + Backbone.js
• in Enyo
Thursday, May 26, 2011
20. Examples!
• FRAPI
• api.getspaz.com
Thursday, May 26, 2011
21. Code from examples
• http://getfrapi.com
• https://github.com/funkatron/wildgarlic
• https://github.com/funkatron/WildGarlic-jqmobile
• https://github.com/funkatron/Spaz-Web-APIs
Thursday, May 26, 2011
22. Q&A
• Axe me
• http://joind.in/3389
Thursday, May 26, 2011