Delphi supports iOS 7

Good to see prompt Delphi support for iOS 7, as reported by Embo’s Sarina DuPont. It’s out and available for download from the registered users site a mere 1 day after iOS 7 was released. Documentation for the new support is on the docwiki. I can’t help noticing, though, that it appears to be an XE5-only update. This is not good news for those still beavering away with iOS code in XE4. I’m sure I remember hearing talk of support for iOS 7 shortly after iOS 7’s release for XE4 iOS programmers. Let’s hope there’s an XE4 update to follow real soon, otherwise this will throw another bone of contention into the mix, and the blogosphere will once again be alight…..
Read More

New 2013 Delphi Developer Days Event

I am pleased to announce a special edition of Delphi Developer Days 2013 and Mobile Development Workshop, to be held this December 4th, 5th, and 6th near London's Heathrow Airport. This three-day event includes the classic two-day Delphi Developer Days 2013 sessions by me and Delphi expert Bob (Dr.Bob) Swart, where Bob and I present joint sessions, where we present in-depth topics together, as well as separate sessions, where we break out into separate rooms to present diverse topics.The optional third day is the Delphi Developer Days Mobile Development Workshop, where Bob and I work with you to develop and deploy mobile applications to your iOS * or Android ** mobile device. This one-of-a-kind workshop includes focused discussions by Bob and me where we explain aspects of mobile development, followed by hand-on sessions where you implement the concepts we describe. During this time we are available to answer questions, provide guidance, and help you build and deploy your sample applications.You can attend all three days of this special event, just the first two days, or only the Delphi Developer Days Mobile Development Workshop. Discounts are available to previous Delphi Developer Days attendees, and their is a special discount for the hands-on workshop available to attendees of this spring's Delphi Developer Days. There are also discounts for early registration.Lunch is provided on each day that you attend. All attendees registered for the first two days will receive our Delphi Developer Days 2013 course book, containing more than 400 pages of material covered in our presentations. Similarly, attendees of the Delphi Developer Days Mobile Development Workshop will receive material on iOS, Android, and FireDAC mobile development written by Bob and me. Space is limited, so register now to reserve your seat.Visit www.DelphiDeveloperDays.com for more information, including registration, agenda, software and hardware requirements, location details, and more.* iOS devices include iPhone, iPad, and iPad mini devices** Android devices must be based on ARMv7 compatible CPUs. Android Jelly Bean is preferred, though most Ice Cream Sandwich and Gingerbread devices are supported
Read More

Hello iOS 7!

Embarcadero extends congratulations to Apple on shipping iOS 7 today. Now that we have the public shipping bits we are doing some final testing our iOS 7 Style (which should be available to registered XE5 developers shortly). To whet your appetite, here is a screenshot of the FM Controls samples app we built this early […] … Read More

Read More

XE5 Is Well Accepted

This picture was taken today in Ljubljana before the XE5 presentation (which, thank you for asking, went quite fine, with only two glitches of which one was a human – that is, mine – error).

About 65 people attended, which is a great improvement from the XE4 launch, and quite a few of them have expressed an interest in buying the Delphi/Android combo.

The all present subtext was, however, that “Embarcadero should now slow down the development and FIX THE BUGS!” I cannot disagree with that – since the XE2, the Delphi has become increasingly less and less reliably. The time has come for a big spring cleanup.

— Published under the Creative Commons Attribution 3.0 license

Read More

Read More

Delphi XE5 : SSL / HTTPS on different platforms with TIdHTTP and TRESTClient

Using SSL/HTTPS with Indy’s TIdHttp (or through TRESTClient – which is effectively based on TIdHttp) requires external OpenSSL libraries, which is something most of us probably learned in the past. With Delphi XE5 now supporting different platforms, such as Windows, Mac, iOS devices, iOS Simulator and Android devices, there are now a couple of different libraries and approaches to follow. Btw, if you are using TRESTClient, then you can just assign a URL like https://www.example.com/api to TRESTClient.BaseURL – you don’t have to worry about assigning an SSL IO handler, as you would have to, if working with TIdHttp directly. TRESTClient detects that situation automatically. In one of Marco Cantú’s recent posts you will find some very useful information about how to build your own OpenSSL binaries iOS – which is a good idea from a security standpoint. Marco’s post is basically for iOS only, so I thought I should share an overview that covers all platforms and make this an easy to follow SSL with Delphi recipe. As mentioned above building your own SSL libraries from source is a good idea, but many people would just like to download ready-to-use binaries. For us Delphi users there is a trustful mirror site which has recent builds available since many years: http://indy.fulgan.com/SSL There are dynamic libraries (a.k.a “DLLs”) and static libraries (a.k.a “.a files”) Recent dynamic libraries (32-bit): openssl-1.0.1e-i386-win32.zip Recent static libraries: OpenSSLStaticLibs.7z Windows Download dynamic libraries and put them into the same directory as your exe. You may also put them into your system’s windows\system32 directory. Files (32 Bit) libeay32.dll ssleay32.dll Mac OSX No download required, recent versions of Mac OSX come with OpenSSL pre-installed, you only need to tell your app where the required dynamic libraries (a.k.a dylibs) can be found. On typical Mac installations they are in “/usr/lib/” uses IdSSLOpenSSLHeaders; ... IdOpenSSLSetLibPath('/usr/lib'); You could also deploy these files with your app by adding them to your apps deployment files list (and enable it for Mac OSX and iOS Simulator only) Files libcrypto.dylib libssl.dylib (Both files are usually symbolic links to actual binaries like /usr/lib/libssl.0.9.7.dylib) iOS Simulator No download required, recent versions of Mac OSX come with OpenSSL pre-installed (and which is used by the iOS Simulator as well), you only need to tell your app where the required dynamic libraries (a.k.a dylibs) can be found. On typical Mac installations they are in “/usr/lib/” IdOpenSSLSetLibPath('/usr/lib'); Files libcrypto.dylib libssl.dylib (Both files are usually symbolic links to actual binaries like /usr/lib/libssl.0.9.7.dylib) iOS Device iOS does not allow to load any dynamic code, thus you need to download the static OpenSSL libraries and put them into the main source directory of your application, so that Delphi can find them while compiling/linking your app. Files libcrypto.a libssl.a Android Device Info follows soon! Making your project multi platform As you can actually have one project compiling to all the mentioned platforms you probably want some ifdefs to handle all platforms and their units automatically. Below is a sample DPR file that works fine for me: program SSLTest; uses System.StartUpCopy, {$IF Defined(IOS) and Defined(CPUARM)} IdSSLOpenSSLHeaders_Static, {$ELSE} IdSSLOpenSSLHeaders, {$ENDIF} FMX.Forms, Unit5 in 'Unit5.pas' {Form5}; {$R *.res} begin {$IF Defined(IOS) and not Defined(CPUARM)} IdOpenSSLSetLibPath('/usr/lib/'); {$ENDIF} Application.Initialize; Application.CreateForm(TForm5, Form5); Application.Run; end. Tweet This! Share this on del.icio.us Digg this! Share this on Reddit Get Shareaholic
Read More

Developing Android apps with Delphi XE5 on an ancient Nook Color

With this release I thought I would play around with some of the new android support available. Of course its much more fun if you have a device to play around with, but I wasn't about to run out and get one since I already have an IPad that I switched to after almost two years with my nook color. Which got me thinking, the nook color runs android...so would it be a viable option for
Read More

6 Events, 6 Cities, 3 Days : IITP Mobile Development NZ Tour

If you’re anywhere near Auckland, Hamilton, Wellington, Tauranga, Dunedin or Christchurch next week, then you may see me rushing through looking stressed and/or over-caffeinated. In conjunction with the IITP, I’m presenting in all those cities on Mobile Development, using RAD Studio XE5 of course. The schedule looks like this: 24th September Hamilton (more details) Auckland […]
Read More

Full Text TXT Search In Delphi (+FireDac +SQLite). Sample Working Project.

Finally, the sample project for my full text search implementation in Delphi is ready. The idea involves providing a user of my application the ability to do full text (Google like) searches on a set of documents by searching inside document content. For the task, I’ve selected SQLite for the database and FireDac for the […] … Read More

Read More

Android Application Events

There are a few differences between a Windows App and an Android App that puzzled me initially. Why doesn't my application get FocusChanged Activate/Deactivate or Close when switching between or terminating apps on Android?In this post I also test out Google+'s new support for embedding G+ posts in blogs and web pages.
Read More

Movie #95 – Margins and Padding Confusion

In this YouTube video I take a look at the fact that depending on what version of Delphi and if you are using FireMonkey or the VCL, the definitions of Margins and Padding on controls are different.  Up until Delphi XE4, the usage of Margins and Padding in FireMonkey was reversed to that of the VCL, but now this situation has changed and they are the same, making margins and padding different in FireMonkey between XE3 and XE4 -  confused, watch the video.
Read More

XE5 Trial Download and Install Experience

I haven't received any SA emails, but XE5 is up and the trial is downloadable now, so go try it out folks.I downloaded the trial and it installed and activated the trial flawlessly. The android stuff you need is all automatically installed, and even somewhat configured. (An emulator profile for XE5 is created, for example. Nice!) A launch webinar is planned for Thursday September 12, go sign up now.I haven't been able to test XE5 with my real Google Nexus 7 yet, because my wife is addicted to Scrabble, and I haven't got the heart to steal it from her. Tomorrow evening I will, however.Tonight I just used the emulator, and I have to say, that the Android EMULATOR is a piece of crap, and that this is not Embarcadero's fault.  I have already long lamented the crappiness of the Android EMULATOR technology that comes in the Android SDK/NDK.   If you want to try this out, please please please save yourself some grief and just skip the damn emulator completely.Also, the emulator appears not to properly implement OpenGL/ES, at least not on everybody's computers. It doesn't work at all on my windows 8 computer, which has a high end workstation graphics card.  That means I can't even launch a hello-world firemonkey-android app on my emulator.I have the Android Studio (new Java toolset from google, based on IntelliJ IDEA), I have the classic Eclipse based Android stuff, and I have Delphi XE5 trial.  I have used the Android emulator with these two IDEs for a while now, and I find the speed absolutely atrocious, and I'm running on a quad-core Xeon box with a lot of RAM, and a very fast hard disk.    So, go get a real Android phone or tablet, before you even start playing with Android.  I recommend the Google Nexus 7.Anyways, can I just say that I hate Java, and I hate the Android SDK and its intents and its intent filters, and its XML UI building system.Am I ever excited that, without learning how to properly bean your proxy-factory-intent-filtered snicker-snacks and make them reverse-deionize in a co-variant fashion, while simultaneously generating your user interfaces in giant swaths of hand-coded, XML you could just .....stick a damn button on a damn form, and run the damn thing. You know what I mean? Yeah.Go Delphi.Sorry if that makes me a troglodyte, but that's how I feel.
Read More

Delphi for Android (aka Delphi XE5 aka RAD Studio XE5) has appeared

Blimey, that took me by surprise (again)! I figured it was coming fairly soon, but I didn’t realise quite that soon.

Anyway, Delphi XE5 is here (as is RAD Studio XE5 and siblings), as Tim Del Chiaro on his Delphi Insider blog.

The Trial Edition is up and available for download and those with Software Assurance should have access to the full version.

You can get a run down of what’s new in the XE5 doc wiki – specifically the What’s New page, but there’s also a general What’s New page. However the thrust of this release is all about adding Android to the portfolio of supported target platforms, with the suggestion that you can get applications compiling for both iOS and Android from a single source base.

But before getting bogged down in Android it’s worth mentioning these new features:

  • the REST client library, a new cross-platform framework for easy access of REST-based web services
  • REST debugger
  • the full integration of FireDAC
  • IDE support for MacinCloud
  • Extendible IDE mobile design devices
  • the awesome IDE Insight functionality (Ctrl+. or F6) is no longer a modal dialog but is now a search box
  • style support for the freshly released iOS 7
  • swipe to delete feature on mobile platforms
  • TListView search filtering support
  • the removal of the long defunct WebSnap and InternetExpress (with the suggestion to use IntraWeb and WebBroker instead for similar functionality)

Also there have been a bunch of iOS fixes along the way, as you’d expect.

The full Delphi range of platform targets now covers:

  • 32-bit Windows
  • 64-bit Windows
  • 32-bit OS X
  • iOS Simulator (Intel)
  • iOS (ARM)
  • Android (ARM)

This is achieved with this half dozen compilers:

  • dcc32 – Embarcadero Delphi for Win32 compiler version 26.0 – your regular Win32 Delphi, the latest version updated over many versions since Delphi 2
  • dcc64 – Embarcadero Delphi for Win64 compiler version 26.0 – the 64-bit Windows targeting compiler
  • dccosx – Embarcadero Delphi for Mac OS X compiler version 26.0 – the Delphi compiler that generates 32-bit OS X apps
  • dccios32 – Embarcadero Delphi Next Generation for iPhone Simulator compiler version 26.0 – the NextGen Delphi compiler that builds Intel executables that run in the iOS simulator
  • dcciosarm – Embarcadero Delphi Next Generation for iPhone compiler version 26.0 – the NextGen Delphi compiler that builds ARM executables that run on iOS devices
  • dccaarm – Embarcadero Delphi for Android compiler version 26.0 – the NextGen Delphi compiler that builds ARM executables that run on Android emulators and devices

Android requirements

Because the Delphi compiler generates native machine instructions, its output is processor-specific. In other words it doesn’t target the Dalvik Virtual Machine, where regular Android applications reside, which are basically Java p-code applications that are executed by a variant of the Java VM. Instead it generates raw machine code, as all the current wave of Delphi compilers do (the long gone Delphi for .NET was the exception to this general rule). So because it’ a compiler compiling native machine instructions Delphi’s Android support has the following requirements:

  • there must be a GPU
  • the CPU must be ARMv7 with NEON instruction support
  • the OS on the target device must be one of:
    • GingerBread: Android 2.3.3+ (MR1 or later), which is API level 10
    • Ice Cream Sandwich: Android 4.0.3+ (MR1 or later), which is API level 15
    • Jelly Bean: Android 4.1+ (release, MR1, MR2 or later), which are API levels 16, 17 and 18
  • you can run the app on an Android emulator if:
    • the emulator is set to use the host GPU
    • the emulator is running Ice Cream Sandwich (MR1 or later) or Jelly Bean (release or later)
    • the emulator is not running in a Virtual Machine

These requirements appear here and there in the documentation, mostly concurring with itself: 1, 2, 3. [Update: the 3rd link is new and also lists various devices that FireMonkey apps have been tested on]

[Edit: It should be noted that the Android emulator is an *emulator* – it emulates ARM instructions when set up as an ARM emulated device. This is in contrast to the iOS simulator, which simulates an iOS device by running an Intel code version of the app, where the real iOS app again will be built with ARM instructions for the iOS device ARM chip. The implication of this is that the performance is atrocious and extremely disappointing for most. As Warren Postma details in XE5 Trial Download and Install Experience, you would really be advised to get a cheap Android tablet to test on, and use the emulator as a last resort.]

[Edit: I should add that if you are going to get a cheap Android device to test your apps then you should most definitely take steps to ensure it meets the minimum specifications required by a Delphi application – it must have an ARMv7 chip that supports NEON instructions and be running an appropriate OS version. Thanks for the reminder on that, Jolyon]

How do you find out if your device is supported? Well, the OS version you can find out in the Settings. The path and menu items may vary but goes roughly like this: Settings, About phone (or tablet), Software information, Android version.

To check the CPU details you’ll need to run one of the tools from the Android SDK against your connected device. Delphi installs the Android SDK and NDK if you don’t tell it you have it pre-installed. The Android SDK gets installed into a directory something like: C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk. In the platform-tools subdirectory from there is the Android Debug Bridge, adb.exe.

To run a command against your device it needs to be connected, typically by USB. This requires you to install an appropriate USB driver for your device as the ones located by Windows typically don’t do the job. Refer to the helpful The Delphi Geek blog post on the matter, XE5 and USB Drivers, for more information and links to drivers for the more common Android phone manufacturers.

When your phone is connected you’ll need to launch a command prompt and run an adb command. This may be easiest if you change directory to the platform-tools subdirectory (or Shift+right-click on the platform-tools folder in Windows Explorer and choose Open command window here). Firstly run the command:

adb devices

just to prove that your device can be seen by the Android tool chain. Assuming it can, run:

adb -d shell cat /proc/cpuinfo

This will show you CPU information something like this:

Processor       : ARMv7 Processor rev 0 (v7l)
processor       : 0
BogoMIPS        : 13.52

processor       : 1
BogoMIPS        : 13.52

processor       : 2
BogoMIPS        : 13.52

processor       : 3
BogoMIPS        : 13.52

Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4

CPU implementer : 0x51
CPU architecture: 7
CPU variant     : 0x1
CPU part        : 0x06f
CPU revision    : 0

Hardware        : UNKNOWN
Revision        : 0003
Serial          : 0000000000000000

Check the Processor line to ensure you are running ARMv7. In the Features line check that neon is included in the CPU feature list

Product Launch

There have been various events worldwide over recent fays and more coming in the days ahead, spreading the word about the new Android support in Delphi XE5. Today I attended the London event, which was held in a theatre in the Natural History Museum.

Embarcadero’s JT was over to help with the launch, and also on stage were Jason Vokes and Steve Ball.

I was a long way back in the audience with the zoom on my telephone’s camera on maximum. But this was the theme for the day.

Addenda

If you are keen to try out Delphi’s Android support, go right ahead and start downloading and installing. However I would urge you to read up on how Android development works whilst the download/install process takes place. There are many docwiki pages that help you get a handle on how it all fits together with the main entry point here: Android Mobile Application Development. A whole bunch of subtopics are listed here.

Recent posts about Delphi’s Android support, which pre-dated today’s launch, include the following:

In a previous blog post I discussed the Objective-C Bridge, available when building iOS apps. This is part of the RTL that allows Delphi code to interact with Objective-C API code. Objective-C code is compiled native code and Delphi code is compiled native code, so the bridge allows the two sets of code to get along. You can define Delphi versions of iOS classes (rather akin to how you can declare Delphi versions of Win32 API functions in classic Delphi), create instances of Objective-C classes, inherit from Objective-C classes and generally do what is necessary to access parts of the CocoaTouch API that are not consumed and surfaced by FireMonkey or parts of the API that do not have similar behaviour exposed by FireMonkey.

Oh, I should mention it’s not so much called FireMonkey now. It seems to be getting referred to more and more as the FM Application Platform. I suspect the latter sounds a little more “business”-y.

Anyway, the Android support offers a similar API bridge called the Java Bridge. Now the Android SDK classes are Java classes living in the world of the Dalvik VM. Delphi code is machine code running on the CPU. This is different to the iOS case. So the Java Bridge uses JNI to communicate across the native/managed boundary but basically offers broadly similar behaviour. You can declare Delphi versions of Android classes, create instances of them and communicate with them. So aspects of the Android API that do not get employed by regular Delphi apps can be accessed for the most part.

One shortcoming of the Java Bridge is that you cannot inherit from a Java class, which makes certain things rather tricky. However I’m going to write up my understanding of the Java Bridge and Objective-C Bridge in additional fuller articles with various examples over coming months, and try and offer ways around the Java Bridge shortcomings. Watch this space. Well, ok, you’d do better to read up on all the Android backgrounders in docwiki while downloading and installing XE5 :o)

Here are some more Embo pages for you to chew over and apply due consideration to:

Read More

Read More

Delphi XE5 has been launched! Delphi for Android is here!

Today, Embarcadero launched Delphi XE5, C++Builder XE5 and RAD Studio XE5.You can now develop applications for Android using Delphi!Read much more about how you can use one code base and one team to create multi-device true native apps that target Android, iOS, Windows and MacOS.There are lots of in-person events going on around the world, and don't miss the launch webinars tomorrow!
Read More

XE5 and USB Drivers

If your XE5 installation doesn’t want to recognize attached Android phone when Windows see it perfectly well (and you have done all the groundwork including putting the phone into USB Debugging mode), check if you have installed USB drivers that support adb – the android debugger. Typically, the drivers that are installed automatically by Windows won’t work with the adb. This page links to correct drivers for various phone manufacturers. This StackOverflow topic may help you in case of hard-to-resolve problems. And, of course, read the official documentation on debugging on Android devices first! --- Published under the Creative Commons Attribution 3.0 license
Read More