follow me on Twitter

    Subscribe to
    Posts [Atom]


    iPhone vs BlackBerry Development

    Tuesday, June 23, 2009

    Around the beginning of this year 2009 I started developing heavily on mobile devices. A couple of differences about a mobile platform really drew me in. Mobile devices can have a location specific applications (this can also be determined by ip address on a desktop computer but has no where near the accuracy of GPS). The other is the ubiquitous nature innate in mobile computing. If someone were to send you a facebook request, you no longer have to wait to get back to your desk to confirm them but are able to accept their invitation on the spot from your mobile device.

    I hardly need to convince any of you of these facts but all this hype over mobile devices begs the question which is the best? It would be impossible to say which of these devices is the best. One aspect that seems to have been at the heart of any new computing platform taking off is ability for developers to build apps on top of it.

    I have built applications for iPhone and BlackBerry. This post shows a huge contrast between development on both platforms. I don't want to seem biased but developing on each is vastly different in terms of ease of use. I will start with my experience developing for the BlackBerry.

    Developing on The BlackBerry
    My first step was to figure out the development environment that BlackBerry's are developed on. I found that RIMM created their own called JDE written from pure Java. I think it's one of those programming world maxims that you don't use Java as a front end because to paint the pixels in the user interface is EXTREMELY slow. Native widgets are the way to go because the user interface can draw the view and just call on the operating system widgets. That is why Eclipse is such a beautiful tool and low and behold Eclipse released a plugin for the IDE this year.

    I assumed that the instructions for installing the plugin with Eclipse's Update Manager would be at BlackBerry.com . It was, but boy was it difficult just to register for the developer program. You can't use your RIMM login as your developer login. As you can see I was already getting a bad impression . . . but I pressed on. I then tried to download a version of the plugin for Mac OS X. Let's just say that it doesn't exist so if you're looking, stop! I fired up the Parallels and entered the download address in the Software Updates portion under Eclipse help. Download failed the first time but installed successfully the second. After you prompted for a user name and password in Eclipse. I assumed that this was my BlackBerry login credentials. I put them in and the login dialogue keeps popping up. After a little googling I found that you have to put in your credentials multiple times to make the windows go away. I entered them in 8 more times and voila! The windows vanished, easy as pie!

    Now onto actually creating an app . . . I create a new BlackBerry Project in Eclipse. This sets up all the necessary files to test your BlackBerry app in the simulator. I then went to my old friend Google in search of the proverbial "Hello World" BlackBerry app. Examples of BlackBerry apps are nowhere to be found. The hello world app can be found on RIMM's site and it doesn't have enough functionality to get you anywhere in terms of useful.

    My core language is Java so one would think that BlackBerry apps would be a cinch for the Java expert. However you must have knowledge of the API you are using or all the syntactical knowledge in the world won't matter one iota. The tutorials for implementing the BlackBerry API I are no where to be found. That was the other very disheartening fact I realized about developing on the BlackBerry and that's a lack of community. Of course there's blackberryforums.com, crackberry.com, and the official BlackBerry forums on the RIMM site. Are these forums as useless to everyone else as they were to me? Forget about it!

    So now say you did actually have some sort of project to compile. In the Eclipse IDE you would right click on your project and say run as BlackBerry application. At this point what is either a VCR like device or the BlackBerry's 1980's edition device pops up on the screen as a simulator. You start at the home screen and you have to use the trackball to navigate to your application, all with a mouse pointer. From deploy to opening your application this takes more than a minute. Couldn't they just open the app in development on running the simulator?

    At this point after all the heart ache, toil, monotony, you have a hello world app running on your BlackBerry Simulator.



    Developing on The iPhone
    Onto the iPhone . . . To start developing on the iPhone you go to developer.apple.com/iPhone . You log in with your Apple ID. In ths portal you get Downloads for ALL necessary development components, Getting Started Videos, Getting Started Documents, Reference Library, Coding How-To's, Sample Code, and Developer Forums.

    The first thing that I did was download the couple gig iPhone SDK. After it launches a wizard will install all of its components in the necessary places on your machine.

    iPhone development is done in the XCode IDE. XCode comes bundled with Mac OS X (XCode only runs on Mac OS X). You can download any of about 50 sample applications from the sample code section of iPHone developer portal. They projects can be downloaded as zip files. In the contents you can click on a .xcodeproj file. This will launch your application in XCode. Getting your first application run is that easy.

    When you get hardcore into development you will need to bounce questions off of a community. There are many GREAT forums that will answer your questions within minutes. There just seems to be a larger more interested developer base for the iPhone than the BlackBerry. A couple of them include: stackoverflow.com , devforums.apple.com, iphonedevsdk.com .

    The iPhone is written in Objective-C which is a language you would never learn if you weren't developing on an Apple device. The collection of API's is Cocoa and takes some getting used to as well. Seeing Cocoa at work in sample applications makes all the difference.

    Apple really made it intuitive to develop on the iPhone which is interesting because usually the developer is the last segment they ever think about. Code and project samples are copious on the web. The community is eager to help each other. Writing code, compiling and deploying is all done with a single button within XCode.

    To conclude developing on a BlackBerry is tedious to say the least. Developing on the iPhone is tough at first but is extremely pleasant once you gain knowledge of the development environment.

    I would love to hear from all of you and hear what your experience is. Am I way off the mark? I don't think so but I'd love to hear your opinion.

    Labels: , ,


    switch between views with buttons on the iPhone

    Saturday, June 06, 2009

    This took me a while to figure out (what's new) but I solved the problem by implementing some code in the app delegate based on the following code:

    This goes in the app delegate
    - (void)flipToTwo {
    SecondViewController *aSecondView = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
    [aSecondView release];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionFl ipFromRight forView:window cache:YES];
    [viewController.view removeFromSuperview];
    [self.window addSubview:[secondViewController view]];
    [UIView commitAnimations];
    }

    In my main view class i have the following function, this is connected to a button done in interface builder so that when the button is clicked appdelegate is called and dold to flip the view.

    - (IBAction)tellDelegateToFlipViewsid)sender {
    AncientWisdomAppDelegate *mainDelegate = (AncientWisdomAppDelegate *)[[UIApplication sharedApplication] delegate];
    [mainDelegate flipToTwo];

    Thanks to genemartone posting this at http://www.iphonedevsdk.com/forum/iphone-sdk-development/4052-have-someone-example-uibutton-switch-view-i-am-despair.html



    }

    Labels: , , ,


    How to retrieve local phone number with iPhone SDK API

    Friday, June 05, 2009

    NSString *phoneNumber = [[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"];

    Labels: , ,