Skip to Navigation | Skip to Content



Archive for the 'phonegap' Category

BlackBerry Build Script | December 1st, 2009

Hey everyone,

We’ve been making some exciting progress with PhoneGap recently.

The Ant Window in a PhoneGap BlackBerry project

First, the Mobile Spec - our own homebrew set of tests for the PhoneGap API - is taking off. People are starting to watch it, fork it, and add to it. I am really stoked to see that - keep it coming!

Second, the PhoneGap team has been working on making developing and building PhoneGap applications easier. A big step towards this was putting together some build scripts so that you - the PhoneGap developer - did not have to go through the same, tedious steps to test and develop applications in your platform’s IDE. Shazron recently rolled out an installer for those iPhone PhoneGap developers out there and I saw it in action (as detailed in this post) - it is hot shit. Super-easy! Joe has the same thing going for Android, the Android.jar he put together is a huge step towards that. So, without further ado, I present to you: an Apache Ant build script for PhoneGap BlackBerry! I’ve added it to the repository, as well as instructions in the readme on how to use it.

In my short time using it, the biggest win for me as a developer is the ability to build, sign and deploy to device with one command. It’s super-fast too - way faster than using RIM’s ‘Desktop Manager’ software to load the application onto the device.

If you’ve tried using it, post to the comments and tell me how it went! I’d be glad to help out, too, if you’re having problems.

Have fun!

Posted in BlackBerry, Mobile Applications, phonegap | 5 Comments » | Add to Delicious | Digg It

Mobile Spec is here | November 4th, 2009

The big thing around the office for the past year or so now has been PhoneGap. It’s gaining in popularity every day, and recently we’ve had applications starting to trickle into application stores other than the iPhone one! We now have one application out in the Nokia Ovi store, and one on the BlackBerry App World. I’m pretty excited to see PhoneGap getting a lot of mention all over the place, but this also puts more pressure on the PhoneGap team to have a solid framework that works consistently across all of the platforms that we support currently: iPhone, Android, BlackBerry and (some) Nokia models.

Mobile Spec running on a BlackBerry simulator

Mobile Spec running on a BlackBerry simulator

With PhoneGap being an open-source project, it is sometimes difficult to devote a lot of time to it all at once, and development coming in from user contribution is huge. One thing that is certain about open-source projects, especially ones where there are many contributors and an open development philosophy is used, is that having a set of tests is fairly essential. If developers wants to hop in and help out, in any way that that may be, they need to be sure that the changes they make don’t break the entire application. This becomes even more important as a project gets bigger.

So after that long-winded introduction, I want to point people’s attention to the new Mobile Spec that we have started to work on. You can find it on GitHub. Joe, our main PhoneGap Android developer, has his own fork of it that he’s started to fill up with tests, so we’ve made and are currently making progress on it. Yes! I love automatic regression testing - call me a geek, but I can’t help but have a warm fuzzy feeling inside knowing that test cases for something I’m working on are constantly trickling in :) . Obviously, the spec is in its infancy stages, but it’s a big win. The more we put into it, the easier it will be to develop for it down the road, and the more it solidifies the stability of PhoneGap overall.

Since day 1, PhoneGap’s goal has been for PhoneGap to cease to exist. That is, if all of the big players in the mobile space suddenly decided to work together and unify their third-party application development process, then PhoneGap wouldn’t need to exist as a project. Related to this, the PhoneGap JavaScript API is mostly based off of the HTML 5 specification - open standards are good and healthy for the developer community. What I’m getting at is that the Mobile Spec we’re putting together - maybe / potentially / hopefully - may end up being a decent test suite for the HTML 5 spec, or at least the mobile portion of the spec. Or maybe I’m just too optimistic ;)

We’ve opened this thing up to the community and we want to hear what you guys think. Have a beef with the API? Fork the mobile spec on GitHub, change it to what you think it should be, and then send us a pull request. We’ll definitely have a look.

Here’s to many forks! Cheers!

Posted in Mobile Applications, Test-driven development, phonegap | 6 Comments » | Add to Delicious | Digg It

PhoneGap BlackBerry Progress | September 11th, 2009

Hey everyone,

It’s been a busy past two weeks in the PhoneGap world, especially concerning the BlackBerry branch. We (Nitobi) have put a lot of work into this branch for the past week or two because we’ve got clients who are asking for BlackBerry support for the slew of new mobile applications we’re developing. It’s exciting because these kind of requirements really push the need for expanding the source code and making it better.

I wanted to share with everyone a couple of problems that we’ve encountered recently while working on these projects, and the solutions I employed to solve these problems. For reference, you can find my GitHub repository containing the latest PhoneGap BlackBerry code here.

First, we had quite a serious on-device rendering issue that didn’t come up whilst testing with the BlackBerry simulator. Basically, scrolling would cause the HTML page and all related assets being rendered to ‘tear’ up as you scroll. Picture to provide a better explanation:

Initial rendering / tearing issue we experienced.

Initial rendering / tearing issue we experienced - just after load on the left, after scrolling down and then up on the right.

Warning: BlackBerry code and JDE references ahead. Proceed with caution.

Since then I have solved the problem by calling invalidate() on the application’s Screen’s Field objects, and then invoking Screen.doPaint(). One issue still stands that we currently can only do this in a Timer Task that runs every x milliseconds, so intermittent tearing is still an issue. I tried to resolve this by executing the same invalidate / doPaint code in a custom VerticalFieldManager class extension, that hooked in the redraw code on scrolling events. However, this approach just didn’t work. If anyone has any ideas on how to implement this more elegantly, don’t hesitate to contact me or post a comment - I would love to solve this properly.

Second issue I fixed just today, actually, was a pain-in-the-ass requirement for BlackBerry PhoneGap applications to use a special URI when referencing content that is stored locally on the device. For example, up to this point if your main entry page had an <img> tag that referenced a .png file in the same directory as the main entry page, you would have to set the src attribute of the <img> tag to “data:///<absolute folder path>/mypng.png”. This wasn’t a show-stopper, but it did break the mantra of “write once, deploy to all platforms” that PhoneGap strives to uphold (because, for example, PhoneGap iPhone supports relative and absolute paths within your HTML/CSS/JS).

My solution to this problem was to use a big hash table to store the absolute paths of various resources being loaded, and using the referrer IDs of these resources as the key. Then when we load in requested resources, we check if the referring ID is stored in the hash and build up the absolute path (which we need on the native BlackBerry side to grab the resource data) appropriately. I’m nervous about this approach because I can easily see this causing memory issues down the road - too big of a hash table, or keys being too large.

One mitigating option is, instead of using the entire referrer ID (which can get quite big - essentially it’s the Base64 encoding of the referring resource), hash that down to, say, an MD5 hash, and then use that as a key. That should save some space. Currently, the hashing is done on all resources being loaded, which is obviously overkill. Images don’t need to be hashed, for example.

Questions, comments, ideas, suggestions, please, post away! PhoneGap is an open-source, community-based project, so “just fork it” !

Posted in BlackBerry, Mobile Applications, phonegap | 8 Comments » | Add to Delicious | Digg It


Search Posts

You are currently browsing the archives for the phonegap category.

Archives

Categories