Sunday, 3 November 2013

My first Android App with Delphi XE5

A lot has been going on since Embarcadero released Delphi XE4. I must say I was astonished with what they achieved in such a short time with that version. Just being able to develop your own mobile applications using Delphi was something amazing. Even though I found that version quite cumbersome as it was not trivial the way to deploy your app into an iOS system I gave it a try with no much success (I needed a virtual machine for the Mac device and had to borrow someone's iPad to publish the app, but I'm not a Mac person). So, what I was really waiting for was their latest release Delphi XE5 with Android compatibility. The most interesting part: how simple it is to create a project and deploy it into your android device. In less than a minute you can have your "hello world!" app in your phone with just few clicks. 
Delphi XE5 comes with the Android SDK 22.0.1 32 bit (at least the one that I got when installing Delphi) and you can see all the configuration paths for that particular SDK under Tools -> SDK Manager:

The first step is to enable your device to accept USB Debugging. To achieve this, you can follow the steps from the following link which related the way you have to enable developer mode for Samsung Galaxy Note 3. I have got a Samsung Galaxy Mega, so the same rule applies:

Once done, you will see new options in your phone:

Enable "Still awake" and "USB debugging". Once those are enabled, plug your phone into the computer using the USB cable. Then, the phone will ask you if you want to allow USB debugging: Accept it and let's go to Delphi UI.

Now in Delphi XE5, I will create a very simple project. So, go to File -> New -> FireMonkey Mobile Application.

As my new device is not in the list of available devices, I just choose something that more or less has the same dimensions. In this case as my phablet is a 6.3 inches, I choose the WSVGA 7" option:

Once this is done, I just want to create a simple "hello world" app which consists of displaying a label and when a button is pressed displaying a message. A very simple application but without changing the way I think (I'm building a Delphi application).

As you can see, I'm coding in Delphi. Once this is done, If I have followed the previous steps correctly, my phone should appear under targets for that particular SDK:
Now I just need to Save my project and Run it so it can be automatically deployed in my phone. Once done, I'll be able to see the app in my phone and perform the operations it was designed to do:
Here it is. As you can see really simple steps and with a great outcome: A Delphi App in your most loved android device. Now it's time to explore and do some more research about what you can do here.
Jordi

Related links: