The state of mobile development
Mobile devices are taking over the computing world. Per Gartner and IDC reports, more mobile devices are being sold compared to traditional computing devices like PCs. The biggest players in software (Microsoft, Apple, Google, etc.) have noticed this trend and updated their product portfolios to target ultra-mobile devices like tablets.
Developers are noticing the huge business opportunity these platforms (iOS, Android, Windows 8) offer and they’re looking to build applications that reach out to all possible customers. While the application goal does not change across platforms, the development experience for each platform varies. Developers, with the right tools, can easily port their applications to new platforms. This allows developers to reap great benefits with minimal incremental work needed to support a new platform.
Why build for Windows 8?
The changing landscape of personal computing resulted in Microsoft introducing a blended operating system, Windows 8, in 2012. Windows 8 allows users to interact in the modern shell via touch as well as classic shell. Windows 8 allows users to relish the offerings of a touch-based operating system, while at the same time fallback to the well-known classic shell when working on meaty tasks. This allows users to only have one device for their needs.
Windows 8 already has sold 60 million licenses through January 2013, which indicates the popularity of Microsoft platforms. For developers, Windows 8 represents a huge audience that needs to be tapped. As more Windows users upgrade their PCs, the market for Windows 8 is only getting bigger.
Editor’s note: Microsoft has provided a number of resources to help Android developers port their applications. You can find out more as well as access these resources from their App Builder Portal.
Comparing the platforms/ecosystems (Android vs. Windows 8)
Before we dig into the differences in application development experience between Android and Windows 8, let us take a look at the platform differences between the two operation systems.
The Android operating system is based on a Linux kernel that has been customized for mobile devices. Applications are developed in the Java language, which is compiled to Dalvik dex files (which are the executable files). Android uses the Dalvik virtual machine with just-in-time compilation to run Dalvik ‘dex-code’ executable, which is translated from the bytecode of the application.
The original targeted hardware architecture for Android was ARM and Google has extended support for x86 platforms.
Certain natively coded Java libraries in the Android SDK are available as language specific bindings.
Figure 1: Android architecture diagram
Figure 2: Windows 8 architecture diagram
Windows 8 relies on the Windows NT kernel and, unlike Android and earlier versions of Windows, there are security enhancements to the user mode driver framework that Android developers should note. Windows 8 allows user-mode drivers, which would means that a rogue device would not take down the whole operating system. This allows the system to be more stable. This is one key difference from the Android platform.
WinRT is the Android runtime equivalent in Windows 8, and it is architected to allow applications to run in a sandbox, isolating applications and preventing them from impacting other applications. While Windows 8 supports both Windows Store as well as classic desktop applications, Android application developers would be interested to know about WinRT, which is used by Windows Store applications.
Unlike Android, which allows applications to be installed from “unknown sources,” Windows 8 only allows installation of applications from Windows Store or from a business premise in a controlled setting (for line of business applications).
Android only supports writing applications in Java. In contrast, Microsoft supports developing a Windows 8 application in JavaScript, C#, C++ and Visual Basic. Moreover, the UI for Windows Store application can be created using HTML5, or XAML.
Windows 8 supports a subset of .NET to be used in Windows Store applications. The WinRT APIs are a collection of COM components that reside on top of Windows Core OS. These components are accessible through language-specific projections that are available for C++, C#, VB.NET, and JavaScript.
Difference in developer tools between Android and Win8
Eclipse is the primary IDE for Android development, with IntelliJ being another popular IDE that supports Android development. Eclipse is available on all of the popular platforms (Windows, Mac and Linux), which allows Android application developers to work from nearly any platform.
In contrast, Windows 8 development requires the Windows 8 Pro operating system and Visual Studio 2012. Visual Studio 2012 Express for Windows 8 is available for free and also includes the Windows 8 SDK and Microsoft Blend, which is a fantastic tool for designers. For development purposes, Windows 8 can also be installed as a virtual machine if you do not want to install it as your primary operating system.
Before creating applications, developers are required to obtain a developer license, which is available for free by registering the first time Visual Studio is launched (requires Microsoft account, a.k.a. Windows Live ID) . The developer license needs to be renewed every 90 days.
To publish an application to the Windows Store, developers need a Windows Store account. This costs $49 for individuals (individual account) and $99 for businesses (company accounts). Windows Store applications deployed through company accounts have access to additional capabilities like documents library, enterprise authentication, and shared certificates, which the applications deployed through individual account do not have.
Note that to develop a Windows Store application that needs push notifications, you would need to have a Windows Store account; a developer license alone will not suffice.
Unlike Android, Microsoft has an app certification process that ensures that the application meets certain requirements. This helps customers get the best experience on Windows Store platform.
Microsoft also offers the ability to monitor application crashes/hangs, which are reported to Microsoft when users consent to. This is immensely beneficial for developers who strive to improve the quality/performance of their applications.
Windows Store application style guide
One big difference developers will note is that Windows 8 UX is very different from Android UX. Windows 8 UX relies heavily on personalizing the experience and concepts like updating live tiles to show app updates are not found in Android.
The five design principles for building great Windows Store applications are:
- Pride in craftsmanship
- Be fast and fluid
- Authentically digital
- Do more with less
- Win as one
To help developers build quality applications, Microsoft has published a design/style specification for developing beautiful Windows 8 applications.
In Windows 8, you can choose from one of the following navigation designs:
- Hierarchical system: Most of the Windows Store applications use this system. You can use the hub navigation pattern to make your Windows Store application fast and fluid while still being easy to use.
- Flat system: This is mostly used in games, browsers or document creation apps, where the user moves between pages, tabs or modes that all reside at the same hierarchical level. This pattern is best to support fast switching between number of pages or tabs.
Design assets for Windows 8 are available at http://msdn.microsoft.com/en-us/library/windows/apps/hh700403.aspxfor developers to better understand how to create great Windows Store applications.
Windows 8 equivalent of Android UI development components
The biggest hurdle an Android developer will have to face when building applications for Win8 is to find the equivalents of Android UI concepts.
The good news is that the Windows store Application 8 UI design is similar to Android (but not the same).
-
- An Android application is a collection of Activities, while Windows 8 application is a collection of Pages.
- Each Page in a Windows 8 application is composed of collection of controls/widgets, similar to an Android activity.
- Activities in an Android application are stacked in a LIFO order. A back button click will make you go through all the screens you navigated to arrive at the current screen. Windows 8 does not have a system-wide navigation stack.
- In both Android and Windows 8, the declarative part of the UI is captured in the layout file (XML in case of Android and XAML/HTML/JS in case of Windows 8) and the imperative part of coded in the corresponding Java (Android) /C#, C++, VB.NET (Windows 8) source file.
- Android event handling happens through listener interfaces. Windows 8 applications use delegates which are simpler to register and invoke.
- Both Android and Windows 8 allow event handling to be declared in the declarative part of their UI.
- Android uses explicit intent to invoke activities within the same application, while implicit intent is used to invoke applications outside the application. Windows 8 behaves similarly. In Windows 8, information sharing across applications is done via app contracts and extensions.A contract is like an agreement between one or more apps. Contracts define the requirements that apps must meet to participate in these unique Windows interactions.
An extension is like an agreement between an app and Windows. Extensions lets app developers extend or customize standard Windows features primarily for use in their apps.
Both Android and Windows 8 expose similar UI widgets for text layout and display, editing, listing, image display, radio buttons and checkboxes.
One key difference between Android and Windows 8 is that widget instances in Android are identified by unique integer number values. In Windows, the users define the name of the widget instance and it can be any string value.
Android API equivalents in Windows 8
To help reduce the time developers spend searching for the Windows8 equivalent for Android APIs, I have created the following table, which lists the Windows 8 equivalent for Android APIs.
Android |
Win8 RT |
Win8 JS |
android.app.ActionBar |
Windows.UI.Xaml.Controls.ActionBar |
WinJS.UI.ActionBar |
android.app.Activity |
Windows.UI.Xaml.Window |
|
android.app.AlarmManager |
ApplicationModel.Background.BackgroundTaskBuilder |
|
android.app.Menu |
Windows.UI.Popups.PopupMenu |
WinJS.UI.Menu |
android.content.ClipboardManager |
ApplicationModel.DataTransfer.Clipboard |
|
android.content.Context |
Windows.UI.Xaml.Application |
|
android.content.SharedPreferences |
Windows.Storage.IPropertySet |
|
android.graphics.BitMapShader |
Windows.UI.Xaml.Media.ImageBrush |
|
|
Windows.UI.Xaml.Media.TileBrush |
|
android.graphics.LinearGradient |
Windows.UI.Xaml.Media.LinearGradientBrush |
|
android.graphics.Matrix |
Windows.UI.Xaml.Media.CompositeTransform |
|
android.graphics.Path |
Windows.UI.Xaml.Shapes.Path |
|
android.graphics.Shader |
Windows.UI.Xaml.Media.Brush |
|
android.graphics.Typeface |
Windows.UI.Xaml.Media.FontFamily |
|
android.graphics.drawable.shapes.ArcShape |
Windows.UI.Xaml.Shapes.ArcSegment |
|
android.graphics.drawable.shapes.OvalShape |
Windows.UI.Xaml.Shapes.Ellipse |
|
android.graphics.drawable.shapes.PathShape |
Windows.UI.Xaml.Shapes.Path |
|
android.graphics.drawable.shapes.RectShape |
Windows.UI.Xaml.Shapes.Rectangle |
|
android.graphics.drawable.shapes.RoundRectShape |
Windows.UI.Xaml.Shapes.Rectangle |
|
android.graphics.drawable.shapes.Shape |
Windows.UI.Xaml.Shapes.Shape |
|
android.hardware.Camera |
Windows.Media.Devices.MediaDeviceControl |
|
android.hardware.Camera.CameraInfo.orientation |
Windows.Media.Capture.MediaCapture.GetRecordRotation |
|
android.hardware.Camera.ErrorCallback.onError |
Windows.Media.Capture. MediaCaptureFailedEventHandler |
|
android.hardware.Camera.Parameters.get |
Windows.Media.Devices.VideoDeviceController. GetDeviceProperty |
|
android.hardware.Camera.Parameters.getAutoExposureLock |
Windows.Media.Devices. MediaDeviceControl.TryGetAuto |
|
android.hardware.Camera.Parameters.getColorEffect |
Windows.Media.Capture.MediaCapture.AddEffectAsync |
|
android.hardware.Camera.Parameters. |
Windows.Media.Devices. MediaDeviceControl.TryGetValue |
|
android.hardware.Camera.Parameters. |
Windows.Media.Devices. MediaDeviceControlCapabilities.Step |
|
android.hardware.Sensor (Light) |
Windows.Devices.Sensors.LightSensor |
|
android.hardware.Sensor (Orientation) |
Windows.Devices.Sensors.OrientationSensor |
|
android.hardware.Sensor (Simple Orientation) |
Windows.Devices.Sensors.SimpleOrientationSensor |
|
android.hardware.Sensor (Orientation) |
Windows.Devices.Sensors.SensorQuaternion |
|
android.hardware.Sensor (Orientation) |
Windows.Devices.Sensors.SensorRotationMatrix |
|
android.hardware.Sensor (Gyroscope) |
Windows.Devices.Sensors.Gyroscope |
|
android.hardware.SensorEvent |
Windows.Devices.Sensors.CompassReading |
|
android.hardware.SensorEvent |
Windows.Devices.Sensors.GyroscopeReading |
|
android.hardware.SensorEvent |
Windows.Devices.Sensors.LightSensorReading |
|
android.hardware.SensorEvent |
Windows.Devices.Sensors.InclinometerReading |
|
android.hardware.SensorManager.getAltitude |
Windows.Devices.Geolocation.GeroCoordinate |
|
android.hardware.SensorManager.getInclination |
Windows.Devices.Sensors.Inclinometer.GetCurrentReading |
|
android.hardware.SensorManager.getOrientation |
Windows.Devices.Sensors.OrientationSensor.GetCurrentReading |
|
android.hardware.usb.UsbDevice |
Windows.Devices.Enumeration.DeviceInformation |
|
android.hardware.usb.UsbManager |
Windows.Devices.Enumeration.DeviceInformation |
|
android.media.AsyncPlayer |
Windows.UI.Xaml.Control.MediaElement |
|
android.media.AudioRecord |
Windows.UI.Xaml.Control.MediaElement |
|
android.media.AudioTrack |
Windows.UI.Xaml.Control.MediaElement |
|
android.media.MediaMetadataRetriever |
Windows.Storage.FileProperties.FileProperties |
|
android.Media.MediaPlayer |
Windows.UI.Xaml.Controls.MediaElement |
|
android.Media.MediaPlayer |
Windows.Media.Capture.MediaCapture |
|
android.mtp.mtpDevice |
Windows.Devices.Enumeration.DeviceInformation |
|
android.net.ConnectivityManager |
Windows.Networking.Connectivity.NetworkInformation |
|
android.net.NetworkInfo |
Windows.Networking.Connectivity.ConnectionProfile |
|
android.net.Preference |
Windows.UI.Xaml.Controls.Control |
|
android.net.PreferenceActivity |
Windows.UI.Xaml.Controls.Panel |
|
android.net.PreferenceFragment |
Windows.UI.Xaml.Controls.Panel |
|
android.net.PreferenceGroup |
Windows.UI.Xaml.Controls.Panel |
|
android.net.PreferenceManager |
Windows.Storage.ApplicationData |
|
android.telephony.ServiceState |
Windows.Media.Devices.CallControl |
|
android.telephony.SmsManager |
Windows.Devices.Sms.SmsDevice |
|
android.telephony.SmsMessage (SMS) |
Windows.Devices.Sms.SmsTextMessage |
|
android.telephony.SmsMessage (MMS) |
Windows.Devices.Sms.SmsBinaryMessage |
|
android.telephony.TelephonyManager |
Windows.Networking. |
|
android.view.InputDevice |
Windows.Devices.Enumeration.DeviceInformation |
|
android.view.KeyEvent |
Windows.UI.Core.KeyEventArgs |
|
android.view.View |
Windows.UI.Xaml.Controls.UIElement |
|
android.webkit.WebView |
Windows.UI.Xaml.Controls.WebView |
|
android.widget.AbsListView |
Windows.UI.Xaml.ListViewBase |
|
android.widget.AbsSeekBar |
Windows.UI.Xaml.Controls.RangeBase |
|
android.widget.AdapterView |
Windows.UI.Xaml.Controls.ItemsControl Windows.UI.Xaml.Controls.Selector |
|
android.widget.Button |
Windows.UI.Xaml.Controls.Button |
|
android.widget.CheckBox |
Windows.UI.Xaml.Controls.CheckBox |
|
android.widget.CompoundButton |
Windows.UI.Xaml.Controls.Primitives.ToggleButton |
|
android.widget.DataPicker |
|
WinJS.UI.DatePicker |
android.widget.EditText |
Windows.UI.Xaml.Controls.TextBox |
|
android.widget.GridLayout |
Windows.UI.Xaml.Controls.Grid |
|
android.widget.GridView |
Windows.UI.Xaml.Controls.GridView |
|
android.widget.ImageView |
Windows.UI.Xaml.Controls.Image |
|
android.widget.LinearLayout |
Windows.UI.Xaml.Controls.StackPanel |
|
android.widget.ListView |
|
WinJS.UI.ListView |
android.widget.PopupWindows |
|
WinJS.UI.Flyout |
android.widget.ProgressBar |
Windows.UI.Xaml.Controls.ProgressBar Windows.UI.Xaml.Controls.ProgressRing |
|
android.widget.RadioButton |
Windows.UI.Xaml.Controls.RadioButton |
|
android.widget.RatingBar |
|
WinJS.UI.Rating |
android.widget.ScrollView |
Windows.UI.Xaml.Controls.ScrollViewer |
|
android.widget.SearchView |
ApplicationModel.Search.SearchPane |
|
android.widget.SeekBar |
Windows.UI.Xaml.Controls.Slider |
|
android.widget.TextView |
Windows.UI.Xaml.Controls.TextBlock |
|
android.widget.TimePicker |
|
WinJS.UI.TimePicker |
android.widget.ToggleButton |
Windows.UI.Xaml.Controls.ToggleSwitch |
WinJS.UI.Toggle |
android.widget.ViewFlipper |
|
WinJS.UI.FlipView |
java.io.File |
Windows.Storage.StorageFile Windows.Storage.StorageFolder |
|
java.net.DatagramSocket |
Windows.Networking.Sockets.DatagramSockets |
|
java.net.Socket |
Windows.Networking.Sockets.StreamSockets |
|
java.util.zip.ZipInputStream |
Windows.Storage.Compression.Decompressor |
|
java.util.zip.ZipOutputStream |
Windows.Storage.Compression.Compressor |
|
org.w3c.dom.Attr |
Windows.Data.Xml.Dom.XmlAttribute |
|
org.w3c.dom.Document |
Windows.Data.Xml.Dom.XmlDocument |
|
org.w3c.dom.DocumentFragment |
Windows.Data.Xml.Dom.XmlDocumentFragment |
|
org.w3c.dom.Element |
Windows.Data.Xml.Dom.XmlElement |
|
org.w3c.dom.NodeList |
Windows.Data.Xml.Dom. XmlNodeList |
|
org.w3c.dom.List |
Windows.Data.Xml.Dom.XmlTest |
|
Migration guide FAQ
Q: Do I need to rewrite my whole application including backend services when I migrate from Android to Windows 8?
A: No, the minimum an application developer will need to rewrite is the UI for the application and how the application behaves in response to user interaction. The backend services can be isolated from the front end changes.
Q: What can I do to ensure my backend services will work with all mobile development platforms?
A: Design your backend services to communicate in JSON over HTTP. All mobile development platforms support it, which will reduce the time to migrate any application from iOS/Android to Windows 8.
Q: I don’t see SQLite directly available in Windows 8. What are my options?
A: There are WinRT compatible open source libraries that can be embedded in a Windows Store application to replace SQLite.
Summary
In this article, we have learned how Android developers can port their applications to Windows 8. I hope you have found this information useful.
Editor’s note: Microsoft has provided a number of resources to help Android developers port their applications. You can find out more as well as access these resources from their App Builder Portal.
About the author
Vipul Patel is a Program Manager currently working at Amazon Corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at vipul.patel@hotmail.com
Disclosures: This article was written by an independent author. The article was reviewed by Microsoft Corporation. This site does business with Microsoft.