This is the last of the series Hiedi Utley has written on PhoneGap. I hope you have found the series helpful. We hope to have more of this type of blog post in the future to help with developing mobile applications.
How to Create Your Own PhoneGap Plugin
Today’s topic is about creating your own PhoneGap plugin for iOS
development. PhoneGap provides a whole array of built in features to
access all sorts of things on a device but what if you want to do
something that is not already supported and has not already been
provided by a third-party plugin? Stop fretting, just like adding a
third-party plugin, if you can write a little Objective-C then you can
add your own plugin to PhoneGap as well.
In order to create your own plugin you will have to be somewhat
familiar with JavaScript as well as Objective-C. This tutorial assumes
that you are familiar with JavaScript, Objective-C, the iOS SDK, and the
XCode development environment. This post also assumes that you are
familiar with the PhoneGap project structure and the PhoneGap plugin architecture, so you may want to peruse some of my earlier posts before continuing on if you haven’t already.
Read more..
Showing posts with label iphone. Show all posts
Showing posts with label iphone. Show all posts
Thursday, April 21, 2011
Thursday, March 17, 2011
PhoneGap Tutorial Series – #1 Project Structure and Internals
Heidi Utley, one of the members of our mobile practice, has been working with PhoneGap for one of our clients. She decided to create a series of posts focusing on using PhoneGap for iPhone development.
This first one discusses the project structure. Future posts will review the PhoneGap API, installing a third party plugin, and last building your own PhoneGap plugin.
What is PhoneGap?
PhoneGap is an open source framework for writing applications using typical web technologies like HTML, CSS, and javascript. The PhoneGap architecture supplies javascript wrappers that allow a developer to access native phone features (like contacts, GPS, and the camera) by writing their app against the PhoneGap javascript API.
The basic gist is that the typical web developer will be able to write a standalone HTML/CSS/javascript application that runs in a WebKit browser with access to native functions just by calling the PhoneGap javascript. PhoneGap aides the developer by abstracting the complexities of native development by allowing the developer to write the app in well-known technology without having to learn the intricacies of each mobile platform and thereby hiding the complexity of writing the same application multiple times in various native languages (like Objective-C for the iPhone or Java for Android).
Read more...
Stay tuned as we have more discussions around mobile development. Our team continues with their research, for Chariot's own projects (our conference app for Philly ETE) and for our clients.
Friday, February 4, 2011
Philly ETE 2011 mobile line up!
This post is via Kevin Griffin, Chariot Architect and committee chair of the Mobile tract for ETE:
Philly ETE 2011 mobile line up!
Just thought I would post an update on the current lineup for Philly ETE.
I've been involved in helping get the mobile track lineup sorted out and so far we have confirmed the following:
I've been involved in helping get the mobile track lineup sorted out and so far we have confirmed the following:
- Josh Clark - my favorite 'Tapworthy' author.
- Johnathon Stark - He literally wrote the books on making mobile apps with HTML, CSS and JavaScript.
- Ted Neward - If you are lazy, and want to write Android apps, he has the talk for you!
- Jay McGavren - If you want to write Android apps, in Ruby (Oh yeah!) This is the talk for you (personally, I can't wait for this one!).
- Terry Ryan - Philly Evangelist from Adobe who will use Air, to build Playbook apps. Magic!
- David Kaneda - Although technically on the Frameworks track. Go build your mobile apps in Sencha Touch, seriously go now! That way you can thank him at ETE!
Tuesday, February 1, 2011
Executing JavaScript from Objective-C in an iOS App
New blog post from Steve Smith, one of the Chariot architects working in our mobile practice. Steve is currently working on updating the mobile app for our Emerging Technologies conference and will be posting articles from time to time as he finds challenges or discoveries.
Here is an excerpt:
The other day, I found the need to execute some JavaScript from a native iOS application. After doing a little research, I discovered that the UIWebView has a stringByEvaluatingJavaScriptFromString method. So I decided to create a quick little proof-of-concept to see how to invoke some JavaScript using this. I am not going to walk through all the details of creating a project, etc. and will cut right to the important aspects of making the JavaScript call from the objective-c code.
We are going to need a JavaScript function to call and a UIWebView to evaluate the JavaScript. It would be nice if the JavaScript function took a parameter as well, so we could also prove out the passing of values. Here is the JavaScript function that I will use:
Read more
Here is an excerpt:
The other day, I found the need to execute some JavaScript from a native iOS application. After doing a little research, I discovered that the UIWebView has a stringByEvaluatingJavaScriptFromString method. So I decided to create a quick little proof-of-concept to see how to invoke some JavaScript using this. I am not going to walk through all the details of creating a project, etc. and will cut right to the important aspects of making the JavaScript call from the objective-c code.
We are going to need a JavaScript function to call and a UIWebView to evaluate the JavaScript. It would be nice if the JavaScript function took a parameter as well, so we could also prove out the passing of values. Here is the JavaScript function that I will use:
1 | var area = function(diameter) { |
2 | var radius = diameter/2, |
3 | area = Math.PI * radius * radius; |
4 | return Math.round(area*100)/100; |
5 | }; |
Read more
Wednesday, November 10, 2010
Post Presentation Thoughts from our Mobile Seminar
Kevin Griffin was one of the presenters at our first Mobile Seminar Breakfast. Below is a recap of his thoughts after he finished his presentation.
Yesterday I presented at the first in a series of events for Chariot Solutions, the topic was 'Mobile Design Concepts'.
My goal was to try present things that I had learned/seen/been shown/done over the last couple of years, and try to get the audience out of the 'desktop browser' mind set when developing for mobile.
I drew from a lot of people that I have seen/meet including Luke Wroblewski (@LukeW), Josh Clark/Tapworthy (@globalmoxie), Mike Lee (@bmf) William Van Hecke (@fetjuel) and Brian Fling's book 'Mobile Design and Development' which I still think is the first book anyone planning on a mobile project should read. I was probably influenced by many more folks than that, but they are the obvious ones to me at the time of writing.
Cont. reading..
Yesterday I presented at the first in a series of events for Chariot Solutions, the topic was 'Mobile Design Concepts'.
My goal was to try present things that I had learned/seen/been shown/done over the last couple of years, and try to get the audience out of the 'desktop browser' mind set when developing for mobile.
I drew from a lot of people that I have seen/meet including Luke Wroblewski (@LukeW), Josh Clark/Tapworthy (@globalmoxie), Mike Lee (@bmf) William Van Hecke (@fetjuel) and Brian Fling's book 'Mobile Design and Development' which I still think is the first book anyone planning on a mobile project should read. I was probably influenced by many more folks than that, but they are the obvious ones to me at the time of writing.
Cont. reading..
Saturday, April 10, 2010
More Video Reports from Philly ETE
Adam Blum gives us his 30 second overview on his talk at Philly ETE. His talk on best practices for smart phone business apps was well attended. It was great to meet Adam in person.
Tuesday, March 9, 2010
Rapid Mobile Application Prototyping with PhoneGap
There is no doubt that carving out a mobile presence is a priority for many companies offering any type of product or service, or for start ups looking to gain rapid exposure. The Apple App Store has over 100,000 apps on it, and the Android platform is gaining ground. Those are just the cool kids – let's not forget the grandfather of mobile technology, Blackberry. Others in the class include Palm, Symbian and of course, Windows.
Multiple Platforms
With so many platforms available there is a risk of losing focus on developing and producing applications as resources are expended on supporting multiple platforms – a necessary evil as each presents different development environments and eccentricities.
This is why PhoneGap really stands out at the moment as four [1] of the aforementioned platforms share a common factor – a WebKit-based browser. This doesn't include BlackBerry's announcement [2] of their new WebKit based browser to come in late 2010, which takes us to five out of the six platforms.
Enter PhoneGap
Where does PhoneGap sit in this picture? Well, it jumps off the canvas and sits in your lap! PhoneGap allows you to develop applications using HTML, CSS and JavaScript and provides a JavaScript API which enables you to interact with a device's native functionality [3]. In addition to this simple application architecture, PhoneGap comes with build scripts/plugins (PhoneGap extension for XCode) which bundle up your pages into a deployable application.
The packaging and deployment to device for iPhone, Android and Palm was trivial; I can only speculate that the remaining platforms are equally easy to deploy. In light of recent Apple 'crackdowns', as of October 7th [4], 2009, it is worth noting that PhoneGap (version 0.8.0 and higher) is Apple approved.
The JavaScript advantage?
Anyone who has used a JavaScript library, Prototype, jQuery, MooTools etc, knows how powerful they can be. Anyone who has not used them can easily pick up JavaScript basics. The guys over at PhoneGap recommend using XUIJS[5] with PhoneGap as it does not contain a lot of cross-browser compatibility overhead and weighs in at < 10kb compared with jQuery at 24kb – although for simple functionality you may want to avoid using a extra library at all.
Due to the fact that we are ultimately aiming to work inside one browser implementation (WebKit), we are not held hostage by the browser compatibility issues that have haunted JavaScript for so many years. That's not to say that fragmentation in the mobile world is not an issue [6].
Now, I am not going to try to argue that these HTML/JavaScript apps offer greater performance or a better user experience over their native counterparts. However, I will say that PhoneGap will allow the rapid development of an application for multiple platforms, using a single code base [7]. This is ideal for prototyping or for apps that will have a limited life span and do not warrant the time and investment of producing native apps.Considering all of this in combination with developments coming down the pipeline, most specifically HTML5 (which includes WebSockets and Client-side database storage), the potential for these types of mobile applications is vast and genuinely exciting.[1] Android, iPhone (safari), Palm (WebOS) Symbian/S60(WRT) http://en.wikipedia.org/wiki/List_of_web_browsers#WebKit-based_browsers
[2]http://devblog.blackberry.com/2010/02/blackberry-webkit-browser-preview-at-mobile-world-congress/
[3]http://nachbaur.com/blog/phonegap-officially-permitted-on-the-app-store
[4]Checkout the road map for specifics: http://phonegap.pbworks.com/Roadmap
[5]http://code.google.com/p/xui-js/
[6]http://techcrunch.com/2010/03/04/mobile-fragmentation-forever/
[7]ok, you are going to have to tweak it for BlackBerry.
Multiple Platforms
With so many platforms available there is a risk of losing focus on developing and producing applications as resources are expended on supporting multiple platforms – a necessary evil as each presents different development environments and eccentricities.
This is why PhoneGap really stands out at the moment as four [1] of the aforementioned platforms share a common factor – a WebKit-based browser. This doesn't include BlackBerry's announcement [2] of their new WebKit based browser to come in late 2010, which takes us to five out of the six platforms.
Enter PhoneGap
Where does PhoneGap sit in this picture? Well, it jumps off the canvas and sits in your lap! PhoneGap allows you to develop applications using HTML, CSS and JavaScript and provides a JavaScript API which enables you to interact with a device's native functionality [3]. In addition to this simple application architecture, PhoneGap comes with build scripts/plugins (PhoneGap extension for XCode) which bundle up your pages into a deployable application.
The packaging and deployment to device for iPhone, Android and Palm was trivial; I can only speculate that the remaining platforms are equally easy to deploy. In light of recent Apple 'crackdowns', as of October 7th [4], 2009, it is worth noting that PhoneGap (version 0.8.0 and higher) is Apple approved.
The JavaScript advantage?
Anyone who has used a JavaScript library, Prototype, jQuery, MooTools etc, knows how powerful they can be. Anyone who has not used them can easily pick up JavaScript basics. The guys over at PhoneGap recommend using XUIJS[5] with PhoneGap as it does not contain a lot of cross-browser compatibility overhead and weighs in at < 10kb compared with jQuery at 24kb – although for simple functionality you may want to avoid using a extra library at all.
Due to the fact that we are ultimately aiming to work inside one browser implementation (WebKit), we are not held hostage by the browser compatibility issues that have haunted JavaScript for so many years. That's not to say that fragmentation in the mobile world is not an issue [6].
Now, I am not going to try to argue that these HTML/JavaScript apps offer greater performance or a better user experience over their native counterparts. However, I will say that PhoneGap will allow the rapid development of an application for multiple platforms, using a single code base [7]. This is ideal for prototyping or for apps that will have a limited life span and do not warrant the time and investment of producing native apps.Considering all of this in combination with developments coming down the pipeline, most specifically HTML5 (which includes WebSockets and Client-side database storage), the potential for these types of mobile applications is vast and genuinely exciting.[1] Android, iPhone (safari), Palm (WebOS) Symbian/S60(WRT) http://en.wikipedia.org/wiki/List_of_web_browsers#WebKit-based_browsers
[2]http://devblog.blackberry.com/2010/02/blackberry-webkit-browser-preview-at-mobile-world-congress/
[3]http://nachbaur.com/blog/phonegap-officially-permitted-on-the-app-store
[4]Checkout the road map for specifics: http://phonegap.pbworks.com/Roadmap
[5]http://code.google.com/p/xui-js/
[6]http://techcrunch.com/2010/03/04/mobile-fragmentation-forever/
[7]ok, you are going to have to tweak it for BlackBerry.
Wednesday, February 17, 2010
Mobile Platforms - Interview with Roy Rosin and Rick Rasansky
I am a little behind on editing a backlog of videos. As I continue to learn how to edit and not become frustrated with iMovie (why is it Apple can create so many great, intuitive products, yet this one is difficult to use! That will be another blog post for another time!)
This interview took place a few weeks ago, but it seems to be more relevant now with the release of Windows Mobile. I sat down with Rick Rasansky and Roy Rosin at their offices to discuss why it is important to be paying attention to mobile development. Since both of these gentleman have been in the mobile space since early on, they have a lot of experience to draw on.
Rick and Roy will be part of a panel at the Emerging Technologies for the Enterprise Conference (www.phillyemergingtech.com) on April 8th. They are part of a management track which is addressing different Buzz word topics (cloud, social media, mobile). The goal is to help managers have good, non-vendor driven information in their arsenal to guide their choices in 2010.
This interview took place a few weeks ago, but it seems to be more relevant now with the release of Windows Mobile. I sat down with Rick Rasansky and Roy Rosin at their offices to discuss why it is important to be paying attention to mobile development. Since both of these gentleman have been in the mobile space since early on, they have a lot of experience to draw on.
Rick and Roy will be part of a panel at the Emerging Technologies for the Enterprise Conference (www.phillyemergingtech.com) on April 8th. They are part of a management track which is addressing different Buzz word topics (cloud, social media, mobile). The goal is to help managers have good, non-vendor driven information in their arsenal to guide their choices in 2010.
Sunday, January 24, 2010
Mobile development and your team
Throughout the next several weeks, we will be conducting interviews with speakers who will be speaking at the Emerging Technologies for the Enterprise conference (www.phillyemergingtech.com). These interviews will give you some idea of the material we will be covering.
The first interview is with Mark Spence of Transmogrify and Rick Rasansky of Yorn. Rick and Mark will be on a panel discussion in the management track discussing why it is important to pay attention to mobile development for you company.
We tackle a different issue here. Helping your development team get up and running in this newer space.
(As a note, I am trying to get better with editing. Continue to bear with me while I learn "on the job". Please note, I finally purchased a tripod for a steadier picture!)
Here are the links Mark mentions in our interview:
http://cocoawithlove.com/ (cocoa + iphone dev blog)
http://akosma.com/ (iphone dev blog)
http://github.com/facebook/three20 (three20 on github)
http://iphonedevelopment.blogspot.com/ (Jeff LaMarche's iPhone Dev blog)
http://blog.iphone-dev.org/
http://blogs.msdn.com/windowsmobile/ (WinMo dev blog)
http://www.christec.co.nz/blog (Chris Fairbairn's mobile dev blog)
From a design point of view, we like to look at these sites for inspiration:
http://tapfancy.com/
http://www.appsafari.com/
http://wirelessdesignmag.com/
Other useful sites for keeping an eye on everything mobile:
http://gizmodo.com/
http://www.eweek.com/c/s/Mobile-and-Wireless/
The first interview is with Mark Spence of Transmogrify and Rick Rasansky of Yorn. Rick and Mark will be on a panel discussion in the management track discussing why it is important to pay attention to mobile development for you company.
We tackle a different issue here. Helping your development team get up and running in this newer space.
(As a note, I am trying to get better with editing. Continue to bear with me while I learn "on the job". Please note, I finally purchased a tripod for a steadier picture!)
Here are the links Mark mentions in our interview:
http://cocoawithlove.com/ (cocoa + iphone dev blog)
http://akosma.com/ (iphone dev blog)
http://github.com/facebook/three20 (three20 on github)
http://iphonedevelopment.blogspot.com/ (Jeff LaMarche's iPhone Dev blog)
http://blog.iphone-dev.org/
http://blogs.msdn.com/windowsmobile/ (WinMo dev blog)
http://www.christec.co.nz/blog (Chris Fairbairn's mobile dev blog)
From a design point of view, we like to look at these sites for inspiration:
http://tapfancy.com/
http://www.appsafari.com/
http://wirelessdesignmag.com/
Other useful sites for keeping an eye on everything mobile:
http://gizmodo.com/
http://www.eweek.com/c/s/Mobile-and-Wireless/
Tuesday, October 20, 2009
Chariot demonstrates iPhone Application to monitor tc Server performance
Real-time performance insight application will be on display during SpringOne 2GX
We at Chariot have been working on an iPhone application to monitor Java EE application servers. Dubbed "ServerMonitor," the application can connect to an application server and monitor various aspects of the system. This week we are demonstrating integration with tc Server at SpringOne/2GX in New Orleans.
The application uses RESTful web services to communicate with a monitoring web application. The monitor communicates with the JMX Server on the application server and relays the information to the iPhone client.
This application will enable real-time visibility of system availability and current load. After installing and configuring the monitor web application and downloading the iPhone application, users will be able to select the servers to monitor and set alert thresholds for their specific performance requirements. The application can be used as an assessment tool for IT directors and system administrators to direct troubleshooting and performance tuning efforts while in the field.
Expanding the shared knowledge base and skill set in anticipation of future business challenges is a priority for Chariot. A team of Chariot developers is involved in the development and testing of the iPhone app to ensure the successful fulfillment of the vision for the app. The new expertise gained by the development team will be disseminated throughout the Chariot staff via internal training sessions.
“We are pleased to have Chariot as a partner and return sponsor of SpringOne 2GX,“ says Mitch Ferguson, senior director of alliances for the SpringSource division of VMware. ”The new iPhone app will help IT operations staff and systems administrators remotely monitor SpringSource tc Server performance in real time and from the convenience of their hand held device.”
Next steps...
In addition to demonstrating the updated release of the product at SpringOne 2GX, Chariot will also be recruiting a select group of IT executives and systems administrators to participate in a beta test of the iPhone app. Testers will be able to contribute feedback to help deliver a feature set for the app that is most beneficial to individuals in a system administration role.
For more information, or to participate in shaping the product, please contact Tracey Welson-Rossman.
About Chariot Solutions, LLC
Chariot Solutions is an IT consulting firm specializing in application development and systems integration using Java and open source technologies. Chariot consultants include some of the top software architects in the country, all of whom possess a rare combination of deep technical expertise, applied industry knowledge and a genuine love for what they do. Chariot's consulting team has made the company the optimal partner to design, develop, deploy, integrate, support and tune mission-critical systems for companies of all sizes. Visit Chariot on the web at www.chariotsolutions.com.
We at Chariot have been working on an iPhone application to monitor Java EE application servers. Dubbed "ServerMonitor," the application can connect to an application server and monitor various aspects of the system. This week we are demonstrating integration with tc Server at SpringOne/2GX in New Orleans.
The application uses RESTful web services to communicate with a monitoring web application. The monitor communicates with the JMX Server on the application server and relays the information to the iPhone client.
This application will enable real-time visibility of system availability and current load. After installing and configuring the monitor web application and downloading the iPhone application, users will be able to select the servers to monitor and set alert thresholds for their specific performance requirements. The application can be used as an assessment tool for IT directors and system administrators to direct troubleshooting and performance tuning efforts while in the field.
Expanding the shared knowledge base and skill set in anticipation of future business challenges is a priority for Chariot. A team of Chariot developers is involved in the development and testing of the iPhone app to ensure the successful fulfillment of the vision for the app. The new expertise gained by the development team will be disseminated throughout the Chariot staff via internal training sessions.
“We are pleased to have Chariot as a partner and return sponsor of SpringOne 2GX,“ says Mitch Ferguson, senior director of alliances for the SpringSource division of VMware. ”The new iPhone app will help IT operations staff and systems administrators remotely monitor SpringSource tc Server performance in real time and from the convenience of their hand held device.”
Next steps...
In addition to demonstrating the updated release of the product at SpringOne 2GX, Chariot will also be recruiting a select group of IT executives and systems administrators to participate in a beta test of the iPhone app. Testers will be able to contribute feedback to help deliver a feature set for the app that is most beneficial to individuals in a system administration role.
For more information, or to participate in shaping the product, please contact Tracey Welson-Rossman.
About Chariot Solutions, LLC
Chariot Solutions is an IT consulting firm specializing in application development and systems integration using Java and open source technologies. Chariot consultants include some of the top software architects in the country, all of whom possess a rare combination of deep technical expertise, applied industry knowledge and a genuine love for what they do. Chariot's consulting team has made the company the optimal partner to design, develop, deploy, integrate, support and tune mission-critical systems for companies of all sizes. Visit Chariot on the web at www.chariotsolutions.com.
Saturday, September 5, 2009
iPhone and SSL
One of the problems I ran into while working on our iPhone app (see past post) is handling SSL connections. It works just fine with proper certificates, but we have several machines with self-signed SSL certificates. The normal NSURLConnection in the iPhone SDK just rejects connections to a server with a self-signed certificate, and there isn't an obvious API to get around that.
A few searches turned up a way to override part of NSURLRequest or something like that, but it really seemed to be a hack -- plus it seemed to be all-or-nothing, instead of having an easy way to hook into the particulars of each request.
Long story short, I found a better way to handle this, which may be new in the 3.0 SDK. Put this in your NSURLConnection delegate (for asynchronous requests):
Because the delegate typically has more information about the connection, it can make a more intelligent decision in that method. For instance, our app has a config screen where you enter a server URL, username and password if needed, and a checkbox for whether to allow self-signed SSL certificates. So our code above looks up the value of that config setting for the server when the method is called with NSURLAuthenticationMethodServerTrust.
As the comment indicates, the method is only called with NSURLAuthenticationMethodServerTrust once for any given server configuration and the result apparently cached (even across brand new NSURLConnection instances). I'd be interested if there was some way to force it to reset all that and call the method again with NSURLAuthenticationMethodServerTrust.
In a future post, we'll look at how to support HTTPS client cert authentication, which also seems to have better options in the 3.0 SDK.
A few searches turned up a way to override part of NSURLRequest or something like that, but it really seemed to be a hack -- plus it seemed to be all-or-nothing, instead of having an easy way to hook into the particulars of each request.
Long story short, I found a better way to handle this, which may be new in the 3.0 SDK. Put this in your NSURLConnection delegate (for asynchronous requests):
- (BOOL)connection:(NSURLConnection *)connection
canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *) space {
if([[space authenticationMethod]
isEqualToString:NSURLAuthenticationMethodServerTrust]) {
// Note: this is presently only called once per server (or URL?) until
// you restart the app
if(shouldAllowSelfSignedCert) {
return YES; // Self-signed cert will be accepted
} else {
return NO; // Self-signed cert will be rejected
}
// Note: it doesn't seem to matter what you return for a proper SSL cert
// only self-signed certs
}
// If no other authentication is required, return NO for everything else
// Otherwise maybe YES for NSURLAuthenticationMethodDefault and etc.
return NO;
}
Because the delegate typically has more information about the connection, it can make a more intelligent decision in that method. For instance, our app has a config screen where you enter a server URL, username and password if needed, and a checkbox for whether to allow self-signed SSL certificates. So our code above looks up the value of that config setting for the server when the method is called with NSURLAuthenticationMethodServerTrust.
As the comment indicates, the method is only called with NSURLAuthenticationMethodServerTrust once for any given server configuration and the result apparently cached (even across brand new NSURLConnection instances). I'd be interested if there was some way to force it to reset all that and call the method again with NSURLAuthenticationMethodServerTrust.
In a future post, we'll look at how to support HTTPS client cert authentication, which also seems to have better options in the 3.0 SDK.
Subscribe to:
Posts (Atom)