Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiRAD Studio

How To Create A Cross-Platform News App With Delphi

how to create a news app with delphi firemonkey

In this post, I will demonstrate how to create a news application with Delphi FireMonkey. We will integrate one of the market-leading news RESTful web services into our Delphi cross-platform application.

MediaStack API – is a free and simple REST API for live news and blog articles. This service is platform agnostic and can be utilized with any Windows App Development tools quickly. In this demonstration, we will integrate MediaStack API into our Delphi FireMonkey application.

We’re going to create a cross-platform news reading app with Delphi

This is what we create in this tutorial. It fetches data from RESTful web service, and then downloads images and puts them in the news card that we create dynamically.

How To Create A Cross Platform News App With Delphi final screen running in the debugger

Let me first talk MediaStack API a little bit.

What is MediaStack API and why do I need to use it?

You can tap into a world of live news data feeds and access breaking news events around the globe. There is a massive set of sources which is more than 7,500+ and 50 countries included. Furthermore, MediaStack API is one of the scalable platforms that deliver news results quickly.

How do I get API Access Key for MediaStack API?

Just head over to the MediaStack official web page and sign up with the Free subscription plan. It is easy to test it out and start using the API access key in seconds.

How to use MediaStack API?

The MediaStack API is a scalable and yet easy-to-use REST API interface delivering worldwide live news and historical data in handy JSON format. The API response is lightweight and fast.

To get started right away, you just need to get your API access key and start using the HTTP GET endpoint with different parameters.

Here is a sample API request:

How To Create A Cross Platform News App With Delphi getting an API key

And its response:

How To Create A Cross Platform News App With Delphi example response

Besides, by providing different parameters, you can get various news. For instance, historical news with date parameter within the URL.

How to build a cross-platform application with Delphi FireMonkey?

With RAD Studio, you can build high-performance applications 5x faster for Windows, Android, iOS, macOS, and Linux with the same codebase.

With hundreds of components, you can build cloud-aware modern applications in seconds. Moreover, the extensive Form designer provides swift UI designing with the FireMonkey UI framework.

With the latest updates, we, Delphi developers got new features and new tools for the FireMonkey framework. One of them is FireMonkey App Low Code Wizard.

FireMonkey App Low Code Wizard – is a low code development wizard that creates a fully functional Delphi cross-platform application with multiple screens and all the functionalities are configured.

Head over to the Embarcadero website and download the latest community edition of Delphi – if you don’t meet the requirements of the Community Edition license you can use the link at the bottom of this page to download a free trial of the full RAD Studio package. Start using FireMonkey App Low Code Wizard by installing it from the GetIt Package Manager.

How to connect to RESTful web service in Delphi?

Well, to be honest, you don’t see anything like this in other development environments. RAD Studio has been offering hundreds of solid components and development tools. One of them is the REST Debugger.

With the REST Debugger, you can connect any type of web service in seconds. Moreover, you can copy already configured components after connecting to the web service. And by pasting the components to your project, you just need to send requests to get results.

How to create a news app with Delphi FireMonkey?

We have been exploring different APIs and learning how to integrate with Delphi apps. In this demonstration, we again try to integrate the news API, MediaStack API into our Delphi FireMonkey Application.

Create a new project using the FireMonkey App Low Code Wizard and apply all those features in the wizard except the data access part. 

Then open the View.NewForm and paste the REST components from the REST Debugger to the project. 

Make sure to create your project like this structure! As you can see, there are only two components TButton and TVertScrollBox added to the user interface. And we will create news cards into the vertical scroll box. Moreover, you can turn off scroll bars by changing the ShowScrollBars property to False

How To Create A Cross Platform News App With Delphi laying out the screen

Create an OnClick event on the button that you have dropped and write this code.

I hope the source code is well explained. As you can see all the components are created in the runtime. If you have problems with the project demo, please share it in the comments!

How To Create A Cross Platform News App With Delphi the final running app

As you can see, connecting and integrating web services and creating fully functional cross-platform applications is easy and really fast to do with Delphi FireMonkey.

Depending on how much you want customization, you can code it quickly with Delphi. For an alternate take on using the MediaStack API with Delphi, click here.

You can get the full source code for this example here: https://github.com/checkdigits/How_to_Create_a_News_App_with_Delphi_Firemonkey_example

Did you know you can download a free trial of RAD Studio and try out the above example for FREE? Click here to find out more details.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | CS(CyberSec) Undergrad at APU Malaysia | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.