Jump to content
westereng

Delphi for Mobile Applications

Recommended Posts

Hello!

I am just about to start up a quite big project that needs, ios and android apps, in addition to desktop and web apps.

 

I have experience in Delphi for desktop and web, but not for mobile.

 

I am also looking at .Net MAUI to see if that fits my needs. The most important thing for me is that I want to develop all this in one tool/language.

 

So before I embark on the road to learning how to do mobile stuff with Delphi, I wanted to know your experience with creating mobile applications in Delphi.

 

Regards
Ronny

Share this post


Link to post

Hi

Using FireMonkey is globally the same than using VCL except it's more graphic and has more features to auto adapt visual components depending on windows sizes and styles. The big advantage to stay in Delphi is to share a part of your code between desktop and mobiles applications.

 

A lot of samples, docs and books are available to learn how to use FMX features. Check this repositories list https://github.com/DeveloppeurPascal/Delphi-samples/blob/main/OtherDelphiSampleRepositories.md or this books Fearless Cross-Platform Development with Delphi and Expert Delphi (second edition)

 

For the code you only have to learn how to program asynchronously and a few things about Android permissions if you use some APIs.

 

Start by doing a little app like in Delphi Programming Projects

  • Like 1

Share this post


Link to post

My experience is from a long time ago (around 2016), so things might have changed completely (hopefully for the better).

 

All in all, it was disastrous. It was supposed to be some kind of dashboard / remote control app for industrial production lines.

It had to be presented at an exhibition.

 

There were numerous problems I never really got behind, and which each change, I felt more and more helpless because of extremely limiting debugging and analysis capabilities.

  • Battery consumption was inexplicably high
  • We used the TeeChart Pro library for some graphical displays which was extremely buggy on FireMonkey. Steema acknowledged some of the bugs, but never fixed them or provided workarounds.
  • It was around fall, and Apple released a new iOS version. Debugging capabilities in RAD Studio broke and I was more or less flying blind. I think something like this still happens today.
  • Overall performance was completely random, sometimes it was stuttering extremely badly or just terminated. I suspected memory leaks in FireMonkey or TeeChart Pro, but had no way of tracking that down. I felt that if I had stayed with "native" development options (like Apple XCode), I might have had better chances of getting behind such problems.
  • At that time, it was impossible to re-use much existing Delphi because because of the fundamentally different memory management model. I haven't followed it, but I think this should no longer be a problem: Directions for ARC Memory Management in Delphi

All in all, it was considered a failure and we scratched it completely.

Edited by Der schöne Günther

Share this post


Link to post

Yes, it moves between stable-unstable-stable over the years.
But I can say also, that this is mainly because of external effects from Apple/Google, while Firemonkey tries its best to keep up.

I have often seen original XCode and AndroidStudio developers, struggling with the same problems we saw in Delphi, only that those IDE's were maintained more eagerly.

 

And to keep in mind, mobile development is way different to traditional desktop development, I fell into that trap too.

 

 

Edited by Rollo62
  • Like 1

Share this post


Link to post

Since you have a web app, consider a common technique used by Web, Android and iOS developers.

You could simply embed a TWebBrowser component in your application and direct it to your web app's URL.

This approach often goes unnoticed by users and management, providing a seamless experience while

effectively integrating your web app into a native interface.

Share this post


Link to post
52 minutes ago, Der schöne Günther said:

My experience is from a long time ago (around 2016), so things might have changed completely (hopefully for the better).

Yes, things have changed significantly for the better. However, there are still some pain points (more specifically debugging, especially on iOS as Apple keeps throwing curved balls)

 

Main difference is that ARC was being source of significant performance issues on mobile platforms. I have done extensive investigations at the time, and by doing slight modifications in FMX code I was able to significantly improve performance.

 

Used optimizations were covered in my blog posts:

https://dalijap.blogspot.com/2018/01/optimizing-arc-with-unsafe-references.html 

https://dalijap.blogspot.com/2018/01/optimizing-arc-hard-way.html

https://dalijap.blogspot.com/2018/03/optimizing-arc-weakness-of-weak.html

 

Even though there is no ARC compiler, above articles are still valid when dealing with interfaces in Delphi.

 

Removing ARC compiler was not the only performance improvement. Next one was introduction of Skia library in Delphi 12, which gives better performance on mobile platforms. It is not perfect and depending on the project it is not necessarily working better on the desktop FMX applications, but it is easily configurable, so different rendering methods can be used depending on the platform.

 

Another pain point was using 3rd party frameworks on both Android and iOS, and this has also been significantly improved in the meantime. 

 

Overall, plenty of bugs have been fixed in the meantime (of course, that does not mean there are no new bugs), but things are way better than they were at the early beginnings. Most importantly people are successfully using Delphi for writing Android and iOS applications. You can find one such  example here:

 

 

 

Whether Delphi is the best option for some project that is another question and it can really depend on the project. The best option would be putting down all the tech your app needs to interact with and what are basic features you need to support. After you have tall that listed you can make a demo app to see whether you can easily incorporate all that you need across various tools and platforms. Only after doing that you will be able to tell which one will be the best for the project. 

 

And at the end, the grass is not greener on the other side. For development Delphi is much more stable platform than some others. It does not have some fancy features language wise, but its UI frameworks are very stable. Over the years, both Google and Apple made significant shifts in their native frameworks that required extensive code refactoring (yes, you can still use the old ways, but it still requires a lot of work to keep up with changes). If you are looking for cross-platform tool, then situation is not too much different.

 

  • Like 3

Share this post


Link to post

Thank you all for the answers, ans links to resources.

 

7 hours ago, Dalija Prasnikar said:

Whether Delphi is the best option for some project that is another question and it can really depend on the project. The best option would be putting down all the tech your app needs to interact with and what are basic features you need to support. After you have tall that listed you can make a demo app to see whether you can easily incorporate all that you need across various tools and platforms. Only after doing that you will be able to tell which one will be the best for the project. 

Yes, you are of course right, and I'm doing that as we speak. I have gotten quite fluent in c# in the last years (day job), and that would maybe be the obvious path to take. But in this project I am able to choose whatever stack I want(my own company) and since I have a long lasting love affair with pascal/Delphi in earlier years, I am drawn to get back into that universe 🙂

 

Having one environment and one source code for most of the project is appealing because I'm the only one doing this project. So I think it will save me time and resource, although Delphi is not cheap. 

7 hours ago, Dalija Prasnikar said:

You can find one such  example here

Thanks for that, that looks great, and further solidify the point of using one language for everything.

 

7 hours ago, Dalija Prasnikar said:

And at the end, the grass is not greener on the other side. For development Delphi is much more stable platform than some others. It does not have some fancy features language wise, but its UI frameworks are very stable. Over the years, both Google and Apple made significant shifts in their native frameworks that required extensive code refactoring (yes, you can still use the old ways, but it still requires a lot of work to keep up with changes). If you are looking for cross-platform tool, then situation is not too much different.

True, I need stable, and I have Delphi apps written twenty years ago that still works as expected. Not many dev tools can deliver something like that. That is the kind of stable I need, considering this is a one man project.

 

7 hours ago, Die Holländer said:

Since you have a web app, consider a common technique used by Web, Android and iOS developers.

You could simply embed a TWebBrowser component in your application and direct it to your web app's URL.

This approach often goes unnoticed by users and management, providing a seamless experience while

effectively integrating your web app into a native interface.

No web app yet, but it is something to consider yes.

 

6 hours ago, Rollo62 said:

Web app?
Then TMS WebCore this is maybe intersting too

https://www.youtube.com/watch?v=Az7X6jjDRd0&list=PLp3eFyNKVPpvCFj7lLTZjOoIjeH9pcdDA

Yes, web app too :O. I have been reading a lot about Webcore lately, and will probably be the tool of choice going forward, expecially with the new visual designer

 

I guess I am not finding any reason to not go forward with using Delphi for this :classic_blink::classic_rolleyes:

Edited by westereng
..
  • Like 1

Share this post


Link to post
13 hours ago, westereng said:

True, I need stable, and I have Delphi apps written twenty years ago that still works as expected. Not many dev tools can deliver something like that. That is the kind of stable I need, considering this is a one man project.

When it comes to mobile development you cannot count on that kind of stability. Not because of Delphi, but because of platforms. android and iOS get new OS version every year, often with drastic changes in some workflows and features. They also expect that you frequently update your application and make it compatible with new OS versions (old applications still run, but if you don't make an update in two years period applications will not be available to users with new OS versions - this is just example, there are variants of what exactly happens in each particular case).

 

Those OS changes also require changes in Delphi toolset and sometimes additions in code. How drastic depends on the each particular change. This is valid for all mobile development toolsets, and is nothing Delphi specific. But, this also means that you will have to keep current with new Delphi releases and you cannot stick using some old Delphi version for too long after new one gets out.

Share this post


Link to post
2 minutes ago, Dalija Prasnikar said:

When it comes to mobile development you cannot count on that kind of stability. Not because of Delphi, but because of platforms. android and iOS get new OS version every year, often with drastic changes in some workflows and features. They also expect that you frequently update your application and make it compatible with new OS versions (old applications still run, but if you don't make an update in two years period applications will not be available to users with new OS versions - this is just example, there are variants of what exactly happens in each particular case).

 

Those OS changes also require changes in Delphi toolset and sometimes additions in code. How drastic depends on the each particular change. This is valid for all mobile development toolsets, and is nothing Delphi specific. But, this also means that you will have to keep current with new Delphi releases and you cannot stick using some old Delphi version for too long after new one gets out.

Great point, I did not really think about that. That also means increased costs, since I need to keep my Delphi current at all times 😓

 

Using the .Net universe will be the more cost friendly option to consider. But the point about keeping on top of new os versions apply there too...

 

Hmm, not as straight forward choice as I thought 🤔

Share this post


Link to post

Don't forget the cost of maintaining two or more projects in more than one language, with more than one IDE / OS. Depending on the subject, the cost of Delphi licenses is not so high.

Share this post


Link to post
1 hour ago, Patrick PREMARTIN said:

Don't forget the cost of maintaining two or more projects in more than one language, with more than one IDE / OS. Depending on the subject, the cost of Delphi licenses is not so high.

Absolutely, that, to me, is one of the main point to go with Delphi or C++Builder. You have 1 codebase. 
Sure, you'll have conditional compile/code for specific platform, but still only 1 project. No need for 5 different sources/teams to maintain in parallel (it never works) for Windows, macOS, iOS, Android and Linux.

Share this post


Link to post
2 hours ago, Patrick PREMARTIN said:

Don't forget the cost of maintaining two or more projects in more than one language, with more than one IDE / OS. Depending on the subject, the cost of Delphi licenses is not so high.

True, the initial cost of Delphi is quite substantial, but the yearly renewals is something to live with, I know several tools that is more expensive and less capable...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×