Check out the video and slides for Fabian Franz and I’s presentation on autogenerating a mobile application from a Drupal site using PhoneGap. We gave the talk on Wednesday at DrupalCon, and the video is already posted!
I won 2nd place (and a Kindle Fire) in the Twilio DrupalCon 2012 Developer Contest with an Ubercart customer support iPad app. The idea is that a e-commerce site customer support representative could use an iPad that not only handled customer support calls, but also showed the customer’s most recent order information as soon as they call.
I’ve been to a couple of dev days/hackathons sponsored by Twilio, but I’ve never had a chance to actually use Twilio in an app or project. Twilio is a voice-over-IP provider that lets you add voice capabilities to your web application or iOS mobile app. It also handles SMS sending and receiving, if you’re doing text messaging.
Twilio just came out with an iOS SDK, which I thought could be pretty interesting for their DrupalCon Developer Contest up in Denver. The first step I took was to research different ways to use Twilio in Drupal, and I ran across the voip modules – unfortunately, they were only released for Drupal 6 (beta 9), and when I tried out the Twilio integration, I ran into lots of little errors, and Twilio couldn’t connect to my Drupal 6 site. I need to go back and file some issues in the issue queue. I dropped the VOIP Drupal modules, and simply followed Twilio’s directions for integrating the iOS SDK with a standard PHP app, and then rolled that into a Drupal 6 module and dropped it on the server. This actually worked really well, and pretty quickly, I had a phone number I could call from my iPhone that would ring my iPad, and then my iPad could answer the call and I could have a nice, illuminating conversation with myself. Luckily no one walked in on me talking to myself and a few Apple devices. From what I understand, the Twilio SDK is coming to Android pretty soon, and I would imagine the Drupal integration would be exactly the same.
So I had a great little app thrown together for calling someone on an iPad through a telephone number, but that’s not the most exciting thing. Luckily Twilio had one of their developer evangelists stationed in a room at DrupalCon, so I picked his brain about what to add – he suggested CiviCRM, but I’d used that before and didn’t think I could get that integrated in 6 hours. I liked the idea, though, so I went with Ubercart, even though I’d never used it before. Ubercart was actually super easy to set up, so no real issues there. The only catch was trying to figure out how to integrate Ubercart with the iPad app – I ended up rolling my own integration with JSON, because I needed to search Ubercart orders by phone number, and I needed to pull the products that the order contained as well.
On the iPad side, I used the AFNetworking library, which makes asynchronous network calls extremely easy. I also created a user interface in the Apple’s XCode Interface Builder, which is more or less drag-and-drop for positioning UI elements.
That actually took a decent amount of time, simply to get all of the UI elements into place that a customer service rep might need from someone’s order. I wrote some Objective-C to set the properties on each of those UI elements from the JSON returned by my Drupal/Ubercart integration module, and the app now could show order information!
I read the email saying I was selected as a finalist for the Developer Contest around 8am on Wednesday, and I would need to do a 10 minute demo at 5pm – that was great, but I was giving a presentation on PhoneGap and Drupal at DrupalCon at 1pm, so I couldn’t really worry about the Developer contest demo until after that 🙂
There were two other great entrants at the Developer Contest – VuzzBox and Drupal SMS Server – so that was cool to see that there was such a wide variety of things you could do with Twilio and Drupal.
I came in second place, which I’m really happy with – I basically entered the contest so I would have something to keep me from going nuts worrying about my PhoneGap presentation before DrupalCon started! Now my plans are to figure out if there is an actual need or desire for this app with some of the e-commerce/shopping cart packages out there – if this sounds interesting to you, let me know!
GitHub Project URL – https://github.com/jefflinwood/Drupal-Map-App-for-iPhone-and-iPad
I like writing native iPhone and iPad apps with Objective-C. What I don’t like doing is writing the same code over and over again – it would be great to have a starting point that I can use again and again. I find myself reusing classes, open source libraries, and design patterns from previous apps when I build new ones.
What I’d like to do is share a starting point for creating iOS applications for Drupal sites running Services 3. Because Drupal can do many different things, this isn’t going to be a general-purpose Drupal client that you can just point to a Drupal server. Instead, it’s meant to be the first 20% of a mobile application project.
I’d like to get feedback from others about how they would use this, and what they would like to see in the project.
This project is an example iPhone/iPad application with a common code base that pulls location-based information about businesses from a Drupal 7 web site, displays it on a Google Map inside an iPhone or iPad app, and then lets you pick a business to display.
Credit to Open Source iOS Libraries used in this App
- AFNetworking – https://github.com/AFNetworking/AFNetworking – this great HTTP networking library makes async HTTP REST calls very easy to do. Much credit given here for all of the heavy lifting
- SVProgressHUD – https://github.com/samvermette/SVProgressHUD – the activity indicator that Apple should have included with iOS – works great for showing progress while downloading networked data
Drupal 7 Setup
I’d like to bundle all of the Drupal 7 functionality together into a Drupal “app” (different from a mobile app), or possibly just a feature. Basically, the modules you need are:
- Services 3
- Services Views Address Field
I added a REST endpoint with access to get nodes, and access to get views. I also created a content type called business with an image field, an address field, and a geofield. There’s a simple view that just returns all businesses, but I would like to improve that with proximity search. Unfortunately, the current proximity search solution for Geofield doesn’t seem to let me alter the origin point from the view’s arguments, so there is some work to be done there.
I used the Acquia Dev Desktop to build this Drupal 7 site locally, so I don’t have it up and running on a server just yet.
The URL for your Drupal site is in AppData.m – change the REST URL to match your site’s end point, and change the image URL to match your site’s image directory for large image thumbnails.
Send them to email@example.com
Or get in touch with me through my web site http://www.jefflinwood.com/ or