Build 2015 Microsoft has shared more details of its plans to enable Android and iOS apps to be ported to Windows 10 at its Build developer event in San Francisco.
The goal in both cases is to plug the “app gap” by making it easier for developers to support Windows 10, but the approach taken in each case is radically different.
Objective C will be deeply integrated into Microsoft’s tool chain, whereas the Android support is more of a quick fix that involves less work for developers, but cannot achieve the same results. Android apps are built with Android tools – Eclipse, Android Studio or IntelliJ IDEA – whereas Objective C apps are built with Visual Studio.
Here is the Android story, the project code-named Astoria. Android apps on Windows 10 are mobile-only, so think phones and possibly small tablets rather than PCs. You can take your compiled Android APK file and package it as a Windows app.
“We take the APK and convert that into a Windows Appx”, said Sundaram. “This allows us to run it as a native Windows app in a trusted and secure environment.” The APK remains in the package, though; it is not cross-compiled.
An Android-converted Appx runs using an Android subsystem on Windows. This is not an emulator or virtual machine but instead redirects low-level calls to the Windows kernel, drawing on work done for previous Microsoft efforts such as Windows Services for Unix.
There is also an automatic redirection of calls to Google Play Services.
“We wrote a service interop library which automatically converts all the Google calls to Microsoft equivalents,” said Sundaram. Examples include Google Maps being replaced by Bing Maps, and Google Cloud Messaging converted to Windows Notifications.
While it is possible that the app could just work, it is likely that some customization will be needed. Microsoft has Java libraries which wrap a subset of Windows Runtime APIs in order to support features such as Live Tiles which do not exist on Android. You can also replace automatically converted icons to Windows-specific icons. You can use conditional code in the Java or C++ source in order to maintain a single code base.
Debugging is done using Microsoft’s Windows Phone emulator. Microsoft has added support for ADB (Android Debug Bridge) commands to enable IDE integration.
The company has used Android KitKat as its compatibility target. This is a work in progress and not everything is supported, but Android developers keen to support Windows 10 will be able to get existing apps running quickly in many cases. That said, while Microsoft has done some work to make the user interface work like Windows, for example with clipboard support, the resulting apps do still look like Android apps from what we saw at Build.
Objective C - and what was that about ARM 64?
What about Objective C, the project codenamed Islandwood? Visual C++ heavyweight Jim Radigan, who leads Microsoft’s backend compiler team, explained that Objective C will now be a supported language in Visual Studio that compiles to Windows binary code – though we are still talking Universal App Platform (UAP, also known as the Windows Runtime), not Win32 desktop apps. There is full access to the UAP API. Ported apps can run on both PC and mobile, with no restrictions over display size.
Debugging an Objective C app in Visual Studio
Microsoft has also written libraries to support a subset of iOS APIs. Rather than tracking a specific iOS version, it is supporting those that are most used. The list includes UIKit, CoreAnimation, CoreGraphics, CoreText, Touch, OpenGL, OpenAL (for audio), Sensors, ARC (Automatic Reference Counting), Foundation and CoreFoundation, and services including StoreKit and Notifications.
The case study for this is Candy Crush Saga, developed by King and ported to Windows Phone with a early version of the Objective C compiler and already popular. This kind of highly graphical app is not so much affected by look and feel issues on other platforms.
Porting an Objective C app begins with importing the project into Visual Studio. Developers will get a typical IDE experience with syntax highlighting, auto-complete, and full debugging with breakpoints and call stacks.
The Objective C SDK will roll out “over the summer”, said Microsoft, and more information is available here.
A common question here at Build is about Swift, Apple’s newer language which is popular both for its productivity and high quality code generation. “We’re going there, it’s just a day and a time,” said Radigan, immediately corrected by another Microsoft speaker to “No comment”.
Radigan also raised speculation by presenting a slide showing how Windows is compiled for “x86, x64, ARM 32, and a new processor coming out in the fall.” ARM 64, or something else?
Porting apps to other platforms is rarely straightforward. Small differences in UI behaviour can be awkward and time-consuming to fix. iOS apps are not designed to run in resizable windows. Microsoft’s libraries emulating Android and iOS APIs will be imperfect and differences in detail between services offered by Microsoft, Apple and Google are likely to cause problems. Even when everything works, there can still be “look and feel” issues that make ported apps less satisfactory to users.
Nor can Microsoft assume that easy porting means that developers will rush to bring their apps to Windows 10. Amazon has struggled to entice developers to its Fire platform, even though this really does run Android. There is a cost to supporting a new platform even when porting the code is easy; it still requires testing, user support and administration.
That said, the company has done some smart work, particularly with its Objective C support which means developers can go as far as they choose in sharing as much code as possible, or preferring to create a new user interface while sharing only non-visual code. A key question will be whether companies that already support both iOS and Windows Phone, but with an inferior implementation on Microsoft’s platform, will now be able to keep both platforms in parity.
Easier app porting from iOS and Android will not fix Microsoft’s app gap on its own, but if Microsoft can make Windows 10 compelling in its own right, it could help attract developers currently working with other platforms.
The other question is whether this move will damage the Windows ecosystem by encouraging app developers to give Windows a quick and unsatisfactory port rather than an app that has a fully native look and feel. It is a risk – and no doubt a matter of much debate within the company. It is more of a risk with the Android approach, though. The support for Objective C goes deep, being not just a porting kit but native support for a new language. Given that iOS also has the best apps, this could work well for Windows 10. ®