SUP & PhoneGap
Back in April, I posted a blog entry describing the mobile development partnership announcements we made and what they meant for developers. We (and our partners) have started delivering the developers tools/components based on those announcements. In what will likely only be the first of many posts about this topic, I’d like to talk about what we’ve done to integrate PhoneGap with the Sybase Unwired Platform.
A few weeks ago, SAP released SUP 2.1 ESD #3 (what I tend to refer to as SUP 2.1.3) which includes the first step in the announced integration of SUP and PhoneGap. With this release, SAP has added support for PhoneGap applications in the SUP Hybrid Web Container (HWC) for Android and iOS devices. Similar support for BlackBerry and Windows Phone devices is expected in the next release of SUP.
So, what does this mean for developers? Let’s take a look…
PhoneGap API Support
Developers can enhance existing SUP Workflow applications with calls to PhoneGap APIs or can run existing PhoneGap applications in the HWC. For existing PhoneGap applications running in the HWC, you will probably want to update your application’s code to take advantage of some of the services and capabilities offered by SUP and the HWC, but there’s nothing that says you have to do that.
Information about the PhoneGap integration with the SUP HWC can be found here: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01218.0213/doc/html/vhu1333388478507.html.
PhoneGap Plug-in Support
While having the ability to access PhoneGap APIs from a HWC application is interesting, the biggest benefit of the PhoneGap integration with the HWC is through PhoneGap plug-ins. The SUP HWC is extensible; the source code for the container is made available to developers and there’s documentation available that shows you how to make changes to the HWC. Unfortunately though, this requires the developer to dig through the HWC source code and make his or her changes directly to the container’s code.
PhoneGap on the other hand is easily extensible; there’s a published interface for PhoneGap plug-ins and there’s a large community of developers creating plug-ins for PhoneGap using the plug-in interface. PhoneGap Build, Adobe’s cloud-based packaging utility for PhoneGap applications is even adding support for plug-ins, making plug-ins even more popular. Since the HWC in SUP 2.1.3 now includes the PhoneGap native libraries, PhoneGap plug-ins can run in the HWC as well. If you want your workflow application to do something special that’s not supported by the HWC and PhoneGap, but a PhoneGap plug-in exists for the functionality, you can easily add the plug-in library to the HWC and deploy it to your users. Optionally, you can also create your own plug-ins and package them with your HWC.
Instructions on how to add PhoneGap plug-ins to the HWC are provided here: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc01218.0213/doc/html/vhu1331845245956.html.
To see an example of using a PhoneGap plug-in executing in the HWC, check out this recording of a webcast recently presented by David Fish, an Engineering Evangelist for the Sybase Unwired Platform: http://www.slideshare.net/sapmobile/visualize-data-with-mobile-analytics-toolkit-webcast. In this webcast, he demonstrates a web application running in the SUP HWC that sends an email message using a PhoneGap email plug-in. The techniques demonstrated in this webcast can be easily applied to most any PhoneGap plug-in.
In SUP 2.1.3, the PhoneGap integration with the SUP HWC is using the PhoneGap Libraries and API’s from PhoneGap 1.4.
One of the problems with PhoneGap has been that there were inconsistencies in how the PhoneGap APIs are implemented across different mobile platforms. In many cases, the project folder structures differ between platforms, APIs are not implemented on some platforms and the phonegap.js file was different for each mobile platform. The PhoneGap development team has made some dramatic changes to PhoneGap since version 1.4, tightening up the APIs, fixing a bunch of bugs, implementing a single, consistent phonegap.js file and doing a lot of housekeeping work to make PhoneGap more stable and extensible.
It’s possible you’re already using a newer version of PhoneGap than version 1.4 (which was released in late 2011). If your application requires a more recent version of PhoneGap, you can find instructions on to update the PhoneGap libraries for Android here: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01218.0213/doc/html/vhu1331850985520.html and iOS here: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01218.0213/doc/html/vhu1331845245956.html.
Keep in mind that SUP supports PhoneGap in the HWC on Android and iOS only today.
Just in case you’d like to learn more about PhoneGap, I recently published a book called PhoneGap Essentials – it contains everything you need to know to get started with PhoneGap development. You can find more information about the book at www.phonegapessentials.com.