Prototype Platforms• Bada• Qt by way of C++ (MeeGo, desktops, etc)• Qt by way of PySide• Windows Phone 7• OS X Cocoa• Windows by way of WebKit.NET (Other web business like Chrome App Store and Mozilla’s Open Web apps are interesting to us.)
Contributer Concernstests currently live athttp://github.com/phonegap/mobile-specdocs can be viewed live herehttp://docs.phonegap.comissue tracker can be viewed herehttp://phonegap.lighthouseapp.comwiki we use for planning herehttp://wiki.phonegap.com
PhoneGap Technique1. Instantiate a chromeless browser instance.2. Implement PhoneGap.exec bridge code.3. Implement native plugin code.4. Implement your JS API by wrapping PhoneGap.exec() into something pretty.
iOS init webview* PhoneGapDelegate.m line 178
iOS Native to JSThis was what inspired the original hack!
iOS JS to Native
document.location// I shit you not
Android• Almost the same, except its the opposite.• Also, a saga of experimentation.
Android JS to Native Old SchoolOk, that part is easy! No URL hacking!
Android JS to Native Nu School onJsPrompt override
onJsPrompt// I shit you not
Android Native to JS loadUrl CallbackServer The saga continues...
Android Native to JS* ghetto, but it works and did work for a very long time
Android Native to JS com.phonegap.CallBackServer.java
Android Native to JS
Learnings.• Android imp details have changed or manifested bugs. Our interface has not!• Never underestimate the determination of an engineer to abandon all ‘best practices’ in light of solving a tough problem.
BlackBerry webview// you can’t make this stuff up!
document.cookie// I shit you not
BlackBerry JS to Native
BlackBerry Native to JS
Symbian Bridge• A simple JS shim on top of WRT
webOS Bridge• Another shim... but things are getting interesting here.• NodeJS is available as of webOS 2.0!
Other places• WP7 gives us the ability to bind C# to IE.• Bada and Qt give near full access to WebKit.
Device APIs• sensors• data
Sensors• GPS• Network• Camera• Battery
Data• Contacts• Media
API “design”The “standards” are a mess.Quotes here are not ironic.
Or maybe like this?
Browser Persistence APIs• SQLite has been a complete fuck up.
WAC• formerly JIL and BONDI• a carrier consortium
Browser Media APIs• lets not even go here..• audio and video are horribly fucked up• ESPECIALLY on mobile• we ﬁx em w/ PhoneGap tho!
DAP Media Capture
DAP System Info
DAP Sys Info
DAP API OverviewContactsCalendarMedia CaptureMessagingSystem InfoPermissionsGalleryApp LauncherTasks
WAC API OverviewAccelerometerOrientationCameraDevice StatusFilesystemMessagingGeolocationContactsCalendarTasks
Web-ish SDKs Trending.. • Symbian WRT • HP Palm webOS • BlackBerry WebWorks • Samsung Bada * PhoneGap started in 2008 btw...
Current PhoneGap APIAccelerometerCameraCompassContactsDeviceEventsFileGeolocationMediaNetworkNotiﬁcationStorage
Plugins to the rescueClean from an engineering perspective.Lighter builds possible.Adaptable for 3rd party extensions.Portable to new platforms.Secure only use what you need.Override anything with JS or Native code.
PhoneGap Plugins 1.0CoreMaintained by us.CommunityWild west!PartnerMaintained by you; veriﬁed by us. =)
So, what did we learn? • Devices tend to ship a browser. • Additionally they have an SDK. • Browsers have a location.You have everything required to create a bridge!
Mobile web ﬁrst!• Basics.• Tooling.• Libraries.
Basics: HTML<button>I’m native codes!</button>
Basics: CSS3• media queries come in handy for tablets• many folk using precompilers these days• opacity, rounded corners, gradients and fucking drop shadows fuck ya!
Basics: conﬁg.xml• Lifted from the W3C Widget Spec• Many variants. See rubygem ‘confetti’• Handy for packaging metadata.• Wtf is packaging metadata?
conﬁg.xml• specify assets for loading in various places that might be stored in other various places.• icon, splash screen, index.html path and js pathing• feature capability / security• network restrictions security• title, description, license, author, etc