Few days ago, I wrote a post on my review on Windows Phone. While I have been a Microsoft basher (no not really), Windows Phone is one product that surprised me (and I think most other bloggers as well) and took the smart phone UI to the next level. While Microsoft has been known to make killer user interfaces like Microsoft Fluent UI aka Ribbon, and the famous Start Menu on Windows 95, they haven’t been doing much recently. While they don’t innovate fast enough like Apple, Windows Phone is a whole new innovative product that looks new, refreshing and even “threatening” to competition that, even Apple was forced to make some of its features like Find My Phone of MobileMe free.
Windows Phone is the next major platform
Windows Phone is all set to be the next major platform in the Mobile Space. While it will be second to Apple at least for several years to come, It’ll still garner market share from new smartphone users and competitors like Blackberry and Android. It should be noted that, even while Android is free and can be customized by device manufactures, most companies except Sony Ericsson have vouched for or shown some kind of support for this new Microsoft Operating System. Samsung will be shipping more Windows Phone devices than Android (and even it’s own Bada) in 2011, while Motorola is interested in making Windows Phone devices despite lawsuit. Given all these, as successful developers, I strongly think it’s high time to start porting apps to Windows Phone. Even the mighty Rovio Mobile is making a Windows Phone 7 port of Angry Birds after dissing Microsoft. More info here. To developers like us, it’s another platform that comes with a whole new gold rush. Why not utilize it?
Recently, I ported one of my app, iCash SG and it’s now in the 2nd free app in the Navigation Category and is within the top 40 free apps in Singapore MarketPlace.
I’ll be speaking from those experiences focussing on equivalent techniques between the two operating systems.
Analogies between the two Operating Systems
The two operating systems have many things in similar. For example, both support push notifications, both do not support true multi-tasking unlike Android and both of them are highly restricted compared to classical desktop operating systems. As a developer myself, I’ve tried to de-mystify the different buzzwords used in the Windows Phone forums/blogs and get yourself accustomed with their iOS equivalents.
UITabbar <==> Panorama/Pivot
An app that might be using a tab bar controller on iOS will probably be using a Panorama Control. iOS provides a UITabBarController to support displaying views that are NOT co-related and a drill-down navigation stack through the UINavigationController for displaying increasingly detailed information. On Windows Phone, you would normally use a panorama control for a UI that would use a UITabBarController.
A panorama is a control with a long horizontal canvas extending beyond the screen bounds. Navigation is supported by a flick gesture. Panorama is recommended for showing views that are NOT co-related to each other. For displaying contents that are the same but filtered based on a specific criteria, you must use a Pivot Control.
A good example is the built in Music and Videos hub. When you launch this app, you see a panoramic view that shows the different “parts” of the application like radio, history, music, video etc., When you tap on the “music” item, your music will be organized based on Artists, Album, Playlists etc, using a Pivot Control. In your application as well, when you are displaying co-related content, use a Pivot Control, otherwise, use a Panorama.
Lots of differences here. UINavigationController is something that you add into you app. But on Windows Phone, the operating system provides a service called NavigationService. You use this service to navigate between views in your app. In a sophisticated app, you can also use Silverlight’s powerful Navigation framework class called UriMapper. While you “push” views into a navigation stack on iOS, you “navigate” to a page which is addressed using a Uri, just like how you navigate to a page on a website. While on the surface NavigationService looks very easy to use compared to UINavigationController, it’s not. On Windows Phone 7, you can also navigate out of your app and navigate back in when the user press the back key on the phone. So the design of every page should behave in a “stateless” way. While it’s quite a challenge to design pages like that, If you are depending on information from a previous page, you should cache this when the user navigates out of your page. If this is not done properly, your app might crash when the said page is brought back from, say tombstoned state. Should I say that, such a crash would get your app rejected?
UITableView <==> ListBox
Arguably, The most commonly used control on the iOS is a UITableView. The analogous control to this is a ListBox. However, implementation wise, there are quite a lot of difference behind the scenes. You populate a UITableView using delegate methods, while you populate a ListBox by calling adding contents directly into it’s member Items. A simple code snippet would be
Note that, this object can be any model object of your class. On the iOS, you “customize” the look and feel of the UITableView by customizing each cell with a custom UITableViewCell. On Windows Phone, you do it by a powerful concept called Data binding. Data binding is ahuge concept in itself, that separate books are written for that. However, in this post, I’ll touch upon a few basic concepts on how to display the different entities in the model using this technique.
Building your Interface
You can build your interface on Windows Phone using Visual Studio or programmatically in C#. The interface code is a internally XML based (called XAML) which is again similar to XCode’s Interface builder’s XIB files. For better MVC isolation, interface should generally be created using Visual Studio just like how you create Views using Interface Builder. Alternatively, you can also use Microsoft Expression Blend, which is more matured product than XCode’s designer, the Interface Builder. Actually, whatever Interface builder can do can be done using Visual Studio, but Microsoft Expression Blend augments what Visual Studio can do to your interface while maintaining compatibility in the generated XAML. In most cases, ExpressionBlend is used to build animation driven user interfaces without writing a single line of code, which is usually done programmatically on iOS using CoreAnimation/QuartzCore framework. So if you were wondering how to do that cool animation you do iOS, look no further, Expression Blend is your friend.
UITableViewCell <==> Data Templates
On iOS, the UITableView is usually customized by creating custom UITableViewCell classes. Customized table view cells is arguably the most used step when you write a iOS app. I could even go further and say, if you know to customize a UITableViewCell on the iOS, you already know more than 50% of iOS programming.
On Windows Phone, you do the equivalent by “applying” a data template to the listbox to which you added the items. This template is again written in XAML and can either be hand-coded or can be generated using tools like Microsoft Expression Blend The cool idea of using this tool is that Expression Blend tool is a tool designed and made for designers and programmers usually don’t have to worry about the look and feel of the app.
For better reusability, you can write the data templates as a UserControl and use them instead of directly applying an adhoc template to the listbox.
Isolated Storage <==> NSHomeDirectory()
On Windows Phone, your app specific files are stored in a sandboxed environment much like the iOS. Microsoft’s equivalent of this sandbox is called as IsolatedStorage. Files can be read or written only within the confinements of IsolatedStorage.
One thing to remember here is that, IsolatedStorage by default doesn’t provide you a cache directory like iOS’ NSCachesDirectory. So if your application is going to create large number of cache files, it’s up to the programmer to create a separate cache folder and empty it at periodic intervals.
NSUserDefaults <==> IsolatedStorage.ApplicationSettings
The IsloatedStorage also maintains a LocalSettings file which can be accessed through IsolatedStorage.ApplicationSettings. This is the place where you write your setting related information. Using this is much similar to how you use NSUserDefaults on iOS.
Windows Phone supports four types of notifications.
Toast notifications are notification with alert which are similar to iOS’ notifications with a prompt. However, unlike iOS, users are free to “ignore” your toast notification since it’s not shown as a modal alert.
Tile notifications are notification with a text and badge count to update the tile. This is similar to the badge update on iOS. However, tile notifications are ignored completely by the operating system when the app is not pinned to the home view. So while on the iOS, updating just the badge is a pretty good silent indicator, on Windows Phone it might not.
Raw notifications are something new to the platform. This notification is used to update your apps’ internal state from your server. Remember that, when your app is not running, this is completely ignored. May be in a later version or so, Windows Phone will allow us to “wake” our app from a tomb-stoned state using a raw notification.
A huge and very important diff from iOS is that Microsoft’s push notification implementation will actually let you know if the notification has been delivered successfully whereas iOS is more like a fire and forget kind.
Local Notifications <==> TileSchedule
On iOS , local notifications can do pretty much everything like a push notification. However, on Windows Phone, you can only update the tile image using a “TileSchedule“. As on date of writing, even the tile text or the badge count cannot be updated by a TileSchedule. So if you are writing a weather app, be sure to have tile images for every possible weather conditions. Hopefully, Microsoft might come up with more sophisticated features that can be done using this TileSchedule in a subsequent release of the OS.
How can Microsoft make Windows Phone better for developers
Realtime information from Camera/Camera overlay view. This is a very serious omission and as such, Augmented Reality apps cannot be done and apps that do real time video analytics like barcode readers, business card scanners also are impossible.
Not much support for Local notifications. Using a schedule you can only update the tile image but not the tile count or it’s title.
No proper URL routing support. For example your app cannot handle all “abc://” urls like how you do on iOS.
The developer API is not as matured as iOS. With iOS, you can virtually do whatever Apple has done in its apps, which is not the case with Windows Phone. For example, I couldn’t even figure out how to display the alphabet index like the one you see on the People’s hub. Microsoft has been a company that doesn’t release every API or UI element it uses. For example, on Windows 95, you cannot, at least easily with the tools provided back then (VB 4), build a software that looks native like, say, Windows Explorer or the Internet Explorer. The same applies to Windows Phone 7 today. The default tools available from Microsoft doesn’t allow you to create page animations at least easily. I used this silverlight-toolkit for page animations and even then it doesn’t look as native as how Microsoft do it themselves. Being a indie developer on Microsoft platforms is not as easy as it is on Apple. As on date, to create a slick looking UI like, say the built-in mail app, you might need third-party controls like the telerik, which would set you back by 2000$. Things remain the same as how it was on Windows a decade ago. Hopefully, Microsoft understands this and opens up their APIs and UI elements. I don’t think it makes any sense to depend on third party controls for building a product that looks like the native ones. Apple on the other hand helps indie developers by their WWDC sessions, and giving away lots of source code for free.
As such, just like how every application on Windows look different, every app on Windows Phone will look different unlike iOS.
What Windows Phone has that iOS doesn’t
Hubs Integration is a very important and new concept on Windows Phone and some of the apps you write can integrate itself within the built in hubs. For example if you are writing a radio application, it makes more sense to integrate itself into Music and Videos hub than as a standalone app. Similarly, you can integrate your app within the photos hub as photo editors or if you are a content provider for music, you can provide Album art or lyrics right into the Music hub for the currently playing music.
Similarly, I strongly believe that Microsoft will open up People hub integration and so if you make a twitter client, you can sync your twitter information with the People hub. These are some extra things that you must note while developing for Windows Phone as they have no equivalent.
While there are much more to write, and compare, I think, I’ll write about them in another blog post and hope the post helps in kickstarting with your Windows Phone development.
Do tweet this or share this post if you find it useful.
Follow me on Twitter