Running Delphi Android Applications on Windows Phone via Astoria Bridge

Posted by on in Tutorial

Using the Microsoft Astoria Bridge (currently in beta) for Windows 10 phone (also in beta) you can run Delphi FireMonkey applications on a Lumia phone. This is certainly great news for the Delphi (and C++Builder) developers who want to target the Windows phone platform (beside the Android and iOS ones) with a single source code. Here are some of the steps, information, links to get you started.

A Windows 10 Phone

First of all you need a Microsoft phone (Lumia) capable of running the Windows 10 insider preview. Not many phones satisfy this requirement (and there are further restriction for the Astoria bridge). I bought a cheap (80 Eur/90 USD) Lumia 435 phone. Basic, but good enough for some tests.

Once you have the phone, and installed a ton of useless updates (I found no way to cancel them, and having to replace the operating system wan't really much interested). Anyway, I was already signed up for the Windows 10 Insider preview and so I got to windows.microsoft.com/en-us/windows/preview-download-phone and installed on my phone the "preview app", which in turns can update the operating system. Took a while, but it was a very smooth process. Here is the phone with Windows 10 preview:

Get The Astoria Bridge

The second step is to sign up for the Astoria bridge, get approved by Microsoft (time might vary, but it is not immediate -- from few days to a few weeks, form past experience). The entry page for the bridge is at: dev.windows.com/en-us/bridges/android. Once you get approved, you'll be able to see all of the information. In short, you'll have to open the Android SDK manager, download some additional tools and Java interfaces from an external source, and install the wconnect utility from Microsoft. This can be configured as a bridge between Android adb command and the actual phone, so that the phone is seem by Android as an actual device -- and responds to any command as expected. Once the "adb/wconnect" bridge is configured (took me less than 10 minutes) the device will show up in the RAD Studio IDE:

Ready to Go

At this point you are ready to go. Take an existing FireMonkey application or build a new one, and just target the phone. At start up, the application have a little delay (there is some validation and API mapping taking place), but at runtime they seems to respond without any lag. Not everything works, as this is really a beta bridge, and some of the device sensors seem to be ignored. The only app I could not start is one with advertising, not a surprise.

Here are a few apps I installed and one actually running on the device:

  

(Temporary) Conclusion 

Over the next few weeks (or months), as the Astoria bridge and the Windows 10 Phone OS emerge from beta and become more stable, we plan doing more testing and fully "certifying" the platform as one we support, providing eventual suggestions for migration, and possibly supporting specific Microsoft APIs. But the fact you can run Delphi and C++Builder Android applications almost unchanged on a Windows Phone, beside the other mobile platforms, is certainly a very good news. Single source compiled apps for iOS, Android, and now even Windows Phone is really a unique capability RAD Studio brings to developers.

Also, the applications that use the Astoria bridge are first class UWP (Universal Windows Platform) apps, so it should be possible to distribute and sell them via the Windows App Store. Stay tuned for more information, and let us know if you experience any obstacle (or any success) using the Astoria bridge.

 



About
Gold User, Rank: 7, Points: 457
Delphi and RAD Studio Product Manager at Embarcadero.

Comments

Check out more tips and tricks in this development video: