March 2014 news about “DelphiMVCFramework”

In the last months DMVCFramework has been used in many projects. Some fixes and some new features has been added.

Tomorrow will start the 4th training from the Jan 1st 2014 on DMVCFramework… WOW!

The best selling training is “Developing Web Client applications using AngularJS and DelphiMVCFramework” (a slightly modified version of this classic training

Tomorrow the training will be in italian, however is very popular also the english version.

However, back to the project, there is a first attempt to add some documentations on the project.

So far there are a lot of samples and all the unit tests, however there was a lack on the “classic” documentations. So, I’m happy to say that in the SVN trunk you can find my presentation held at the last ITDevCon2013 in Verona, IT.

If you are using DMVC framework I’ll be glad to have 2 lines of description about your project (numbers not functionalities insights) to put a success case page on the project website.

Here’s the direct link to the documentations:

This is the main DelphiMVCFramework project website:

Stay tuned

Sending Android Intents from Delphi (Part 2)

Some months ago I wrote a post with title “Sending Android Intents from Delphi (Part 1)”. In that post I promised to write a 2nd part… here’s it is!

This time I want to play a video deployed with my APK using an external player.

Some informations are available on the Internet, but to correctly know how to play the video I’ve to inspect my Nexus 5 with the LogCat while using the default file manager to start the default video player.

The app main form  is shown below

The main form
The main form


I’ve added an mp4 video file using the deployment manager.

This is the code under the button click event

procedure TForm1.Button1Click(Sender: TObject);
  Intent: JIntent;
  FileName, DestFileName: string;
  Data: Jnet_Uri;
  CompName: JComponentName;
  VIDEO_FILENAME = 'videoviewdemo.mp4';
  FileName := System.IOUtils.TPath.GetDocumentsPath + PathDelim + VIDEO_FILENAME;
  DestFileName := TPath.GetSharedDownloadsPath + PathDelim + VIDEO_FILENAME;
  // Copy the file into a public path (you can use any public path)
  TFile.Copy(FileName, DestFileName, true);
  Data := TJnet_Uri.JavaClass.parse(StringToJString('file://' + DestFileName));
  Intent := TJIntent.Create;
  if CheckBox1.IsChecked then
    CompName := TJComponentName.JavaClass.init(StringToJString('android'),
  Intent.setDataAndType(Data, StringToJString('video/mp4'));
    on E: Exception do
      Label1.Text := E.Message;

Using the checkbox you can force the OS to show the ResolverActivity.

see you

DelphiMVCFramework is now Open Source!


Yes, just after 1 year of development, and a couple of big projects developed with it, the DelphiMVCFramework has been published as OpenSource.

The project is on google code svn

I’ll talk about it at ITDevCon2013 (

In the trunk there are many samples and I’m planning to put many others.

Main DMVCFramework features

  • RESTful (RMM Level 3) compliant
  • Server side generated pages using eLua (Embedded Lua)
  • Messaging extension using STOMP (tested with Apache Apollo and Apache ActiveMQ)
  • Can be used in load balanced environment using memcached (
  • Fancy URL with parameter mappings
  • Integrated RESTClient
  • Works with XE4 and XE5 (tested, but should works also on XE3 and XE2)
  • Experimental support for IOCP
  • Simple, but very very simple, to use…

It contains also a lot of indipendent code that can be used in other kind of projects.

These are the most notable:

  • Mapper (convert JSON <=> Object, ObjectList <=> JSONArray, ObjectLists <=> DataSets)
  • LuaBinding (integrate Lua script into Delphi native code)
  • LuaTextFilter (convert eLua into plain Lua executable script just like JSP)
Currently DMVCFramework use Embarcadero WebBroker framework, but is not tied to it. I’m working on a version that use IOCP (that is 10 times faster than plain WebBroker) and other web libraries for Delphi.
Code is enough stable and is already used in big production system.
There are a couple of bugs that affect WebBroker and so, DMVCFramework.
In our system, I’ve applied some patches to solve these problems. If you need those patches, ask me (I cannot publish the full code because it is Embarcadero licensed code).
The bugs are:
And another bug that affect also DataSnap and TIdHTTPWebBrokerBridge based projects.
Code is tested on XE4 and XE5 but should works also on XE3 and XE2.

Sending Android Intents from Delphi (Part 1)

As you probably know, I work for the italian embarcadero representative (, so last week, I’ve been in Milan (Italy) with the Delphi Product Manager Marco Cantù, to show the new Delphi XE5 for Android (and iOS…).

Users (old and new) were enthusiastics. The Delphi-WAY combined with the Android openness and flexibility, is really a good way to develop mobile apps for the business customers.

So, after the initial demos some users were interested in sending Android Intents from their Delphi app.

I’ve builded some demos about Intents, so I showed those demos to them (in the next weeks there will be many Delphi for Android training in Italy, so I’ve build those demo in advance)

In Delphi XE5 you can call java classes from the Google SDK. So I started investigating hot to do this.

There are a lot of possibilities, and I’m still doing research, but this is a simple Intent send demos.

The Intents demo app
The Intents demo app


This is the code under the first button.

procedure THeaderFooterForm.Button1Click(Sender: TObject);
  Intent: JIntent;
  // String url = "";
  // Intent i = new Intent(Intent.ACTION_VIEW);
  // i.setData(Uri.parse(url));
  // startActivity(i);

  Intent := TJIntent.Create;

Simple, isn’t it?

With this piece of code, you cann open your device browser to a web site (my blog in the snippet).

Click on the first button and you will be redirected to this blog.

Open browser with intent
Open browser with intent


Intents are REALLY powerfull

With the next snippet, you can send piece of data (e.g. text) to other apps. You dont have to know the apps in advance, Android will do the match with the Implicit Intent. (It is similat to the TShowShareSheet action).

procedure THeaderFooterForm.Button2Click(Sender: TObject);
  Intent: JIntent;
  // Intent intent = new Intent(Intent.ACTION_SEND);
  // intent.setType("text/plain");
  // intent.putExtra(android.content.Intent.EXTRA_TEXT, "Android Rocks!!!");
  // startActivity(intent);

  Intent := TJIntent.Create;
    StringToJString('Delphi Rocks!!!'));
Chose wich apps shoud be launched to handle the intent (and the text)
Chose wich apps shoud be launched to handle the intent (and the text)


Now, if you choose Twitter, you will get this screen.

Intent handle by twitter app
Intent handle by twitter app


I’ve demos about placing a call, sending an SMS, show a PDF file, accessing different kind of storage etc.
In the next part of this mini series I’ll show some other snippets.

There is still many areas to explore…

  • Services
  • BroadcastReceiver
  • Widget
  • Bluetooth
  • I/O
  • …?

I’ll keep you informed…