Mobile app development has really exploded over the past few years. And with that, so have the number of options available to developers. Developers are looking for ways to maximize code reuse while being able to deploy to multiple platforms.
At ObjectSharp’s At the Movies event in May, David Totzke and I talked about cross platform development, and the options available to developers. Let’s face it - developers have a lot of choices available when it comes to selecting a cross platform development framework. PhoneGap, Appcelerator’s Titanium, Telerik’s AppBuilder, Sencha Touch, and Xamarin, to name a few.
The video from the session, below, is the beginning of the conversation. Take a look and then come back here and we’ll go a bit deeper.
Too many choices can be overwhelming, especially for those new to cross platform development, leaving developers to second-guess which approach to take:
These are just some of the initial questions that come up when taking that first plunge into cross platform development.
During our session, we demonstrated an approach for .NET developers that would make transitioning to cross platform development less daunting. We started off with targeting the platforms that .NET developers are most comfortable with – Windows 8.1 and Windows Phone 8.1 – allowing developers to maximize their current skills and programming knowledge, all while expanding their mobile development knowledge in a familiar environment.
We talked about Universal Apps which are apps developed using a common Windows runtime that can run on multiple platforms. If you are not familiar with Universal Apps, check out the post, Extending Platform Commonality Through Universal Windows Apps on the Windows Blog to learn more about it.
Our first demo consisted of a Universal App, allowing us to maximize code reuse between Windows 8.1 and Windows Phone 8.1, with only the need to design a separate user interface tailored to each platform. Our sample application’s purpose was to display a list of the sessions that ObjectSharp had lined up for that day’s At the Movies event.
Creating a new Universal App in Visual Studio 2013
Since Universal Apps allow for a greater capacity of code reuse between Windows and Windows Phone, we designed the app to ensure the majority of our sample application’s code was contained in the Shared App project, as well as the images used within the app and even the code-behind for the application’s Main Page, as shown below. Data binding was used to pump data from the View Model to the View for both Windows and Windows Phone, so the actual code for the application is minimal.
Sample Universal App Project Structure
The only difference that we really need to account for was the UI design and layout between the two platforms. In the Windows 8.1 version, on application launch, a simple list of session names are displayed. Selecting an item in the list would then display a photo of the selected session’s presenter, along with the presenter’s name and a detailed description of the session. In the Windows Phone 8.1 version, the displayed list was in a different format to maximize screen real estate, and provide a user experience that was true to the device.
Shown below are the screen captures for both Windows 8.1 and Windows Phone 8.1.
ObjectSharp ATM Universal App – Windows 8.1 View
ObjectSharp ATM Universal App – Windows Phone 8.1 View
So far so good? Hopefully you’ve been following along and have done the same in your Visual Studio. In the next post, we’ll add on the Portal Class Libraries that I showed in the video. In the meantime, if you have any questions about the above, post your comments below, tweet me, comment on the Microsoft Developer Facebook page, or in the Canadian Developer Connection group on LinkedIn,