Tag Archives: ios

Anatomy Of A Delphi 10.3 Rio Firemonkey App On #Android, #IOS, #Windows, And #macOS

If you are new to working with a full featured framework like Firemonkey you may be wondering at the size of the apps that Delphi 10.3 Rio Firemonkey generates. The Firemonkey Framework has hundreds of thousands of lines of code that allows you to jump ahead and start building the app you want to build now instead of the bricks in the road to get there. Hopefully this infographic will provide some insight into what makes up an APK/IPA cross platform application deployed from Delphi 10.3 with the FMX framework. The infographic covers Android, IOS, Windows, and Mac OSX apps/packages/libraries/archives created using the Firemonkey framework. Tools that utilize the Firemonkey framework are Delphi 10.3, C++Builder 10.3, and RAD Studio 10.3. The infographic only covers Release mode (something you could deploy to your customers). I have also included a VCL section in the infographic so that you can compare the Windows only VCL framework to the cross platform FMX framework. Also keep in mind that when you use debug information or are in Debug mode your file could be significantly larger. The sizes of the generated files are included in the green circles. There is the normal compiled size and then there is the compressed or packaged size. APK and IPA files are packaged and compressed. The compressed sizes for Windows and Mac OSX were achieved using the 7Zip format. Here is some information directly from the infographic as well about what units are included in a FMX app on Android (it is slightly different on each platform) and how those units effect the size of the deployable file.

Let’s start off with a Hello World app which is basically a FMX form with a TLabel on the form. This comes out to around ~5.88MB when deployed to Android as an APK. Even though this is a Hello World app there is already much more functionality here than just the ability to print out ‘Hello World’ to the screen. A true ‘Hello World’ would be much smaller because it would lack these Firemonkey framework units. The FMX and RTL units included are:

System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls

Next up I’ve listed what I call a Basic App that clocks in at ~6.45MB. A basic app has some more visual controls available to it like a TListView, a TEdit, a TListBox, a TTabControl, a TMemo, and even some access to advertising. Here are the FMX units included (in addition to the units from the Hello World app):

FMX.ListView.Types, FMX.Memo, FMX.ListView.Appearances, FMX.ListView.Adapters.Base, FMX.Advertising, FMX.TabControl, FMX.ListBox, FMX.Layouts, FMX.Edit, FMX.ListView, FMX.ScrollBox

This next tier of app size I’ve termed Services because it is basically some Android JAR files which when fully included bring the app up to around ~6.61MB. These services are basically helper services for Android (some of which are provided by Google) like Google IAP, GCM, and Analytics. You can include and exclude each of these files from your APK separately. Here is a list of the additional files:

android-support-v4.dex.jar, cloud-messaging.dex.jar, fmx.dex.jar, google-analytics-v2.dex.jar, google-play-billing.dex.jar, google-play-licensing.dex.jar, google-play-services-*.dex.jar (there are a number of play services covered by this wildcard)

Next up we have what I have termed the Consumer App style app tier which rings in at around ~9.50MB. Obviously if you add more or differently functionality the size of your app can fluctuate greatly. You could also build games and they might fall in this size range depending on how many external graphics and sound you used. This type of app includes more functionality like the RESTClient, the in app purchases unit, sensors, a grid component, and the camera component. Here are the additional FMX and RTL units included by the IDE when these new components (in addition to all of the above) were added:

System.Sensors, System.Rtti, FMX.Grid, System.Sensors.Components, FMX.Media, REST.Response.Adapter, REST.Client, Data.Bind.Components, Data.Bind.ObjectScope, System.Actions, FMX.ActnList, FMX.InAppPurchase

Lastly we have the Enterprise and Database App tier which comes in at around ~11.1MB+ but can increase size from here the more you add to your app. This includes FireDAC functionality for accessing an SQLite database, LiveBindings to bind the data to a grid, accessing various path utility functions, and creating ini files for settings storage. At this level you can add tens of thousands of lines of code and lots of forms and the app could still be around this size. The RTL and FMX units included when this functionality was added (in addition to all of the above units) are as follows:

FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, Data.DB, FireDAC.Stan.ExprFuncs, FireDAC.Phys.SQLiteDef, System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.EngExt, Fmx.Bind.DBEngExt, Data.Bind.Components, Data.Bind.DBScope, FireDAC.Phys,FireDAC.Phys.SQLite, FireDAC.Comp.Client, Fmx.Bind.Grid,FireDAC.Phys.SQLiteVDataSet, FireDAC.Comp.DataSet, System.IniFiles, System.IOUtils, FMX.Grid.Style, Data.Bind.Grid, REST.Types, Data.Bind.ObjectScope

You can also take a deep dive into the Firemonkey Framework itself using the Delphi Unit Dependency Scanner. The unit dependency scanner will show you all of the units that your app uses and all of the units that those units use in a treeview. It will also show line numbers of each unit and a total line number count of your entire project.

You can find out more about the Firemonkey Framework on the Embarcadero DocWiki and on the FiremonkeyX website.

Download the full Anatomy of a Firemonkey Framework Multi Platform App infographic for future reference.

Tags: , , , , , , , , , , , , , ,

13 Amazing Component Sets Driving Success In Delphi Berlin On Android And IOS

There are quite a few Firemonkey component sets available for Delphi Berlin which can get you ahead of the game when developing for Android and IOS. Think of component developers as another part of your team: they do the foundation work for you so you can focus on the actual functionality. Here are thirteen of these component set developers which give you access to everything from FFMPEG video playback to amazing grid capabilities to in app payments to cross platform math libraries to artificial intelligence libraries to scripting components to database access components to native maps to bar code reading and even enhanced camera functionality. Achieving success through third party components is a powerful developer force multiplier.

Alexander Sviridenkov provides the HTML Component Library which contains an HTML Component Library, an HTML Report Library, and an HTML Editor Library. The components are written in Object Pascal and do not use WebView or any other plugins or third party controls. The library contains an HTML parser, an XML parser, a CSS parser, DOM classes with JQuery support, SVG rendering, HTTP/HTTPS clients, and an HTML rendering engine.

Devart provides enterprise grade universal data access component suite called UniDAC. This is an amazing data access component suite which provides direct database access from Android, IOS, Windows, and Mac for a variety of databases. It is possible to connect to Oracle, SQL Server, MySQL, PostgreSQL, and SQLite without using a client library with these components. They also have a SecureBridge offering which provides SSH, SSL, and SFTP components for Firemonkey in Delphi Berlin.

Dew Research provides MtxVec which is an object oriented numerical library for mathematical, signal processing and statistical functionality. On Windows machines it leverages mathematical, signal processing and statistical SSE2, SSE3, SSE4.2 and Intel AVX 1.0 and AVX 2.0 instruction sets. The add ones for MtxVec are DSP Master which is the advanced signal processing package, Stats Master which is the statistical package, and Data Miner which are the artificial intelligence enabling components.

Flash AV Software Corp. provides professional components based on the FFMPEG library and they have a huge number of features. If you are doing video playback professionally on Android and IOS this is the component set to have. They have FFMPEG wrappers for Android, IOS, Windows, and OSX but their components are separated by platform. It features H264 Hardware Decoder playback on some devices devices and support both ARMV7 and ARMV7S CPUs. The formats it supports are all formats supported by FFMPEG and in addition it can play videos from memory stream, HTTP, HTTPS, RTMP, and MMS.

JVESoft provides the JVESoft Components Suite which is a large set of components which are vary useful for any developer releasing professional consumer level apps on Google Play and the Apple App Store. The suite comes with a large number of third party ad component integrations, analytics, in app purchases, push notifications, simplified setting storage and social login components.

Mitov Software provides quite a few components but for Firemonkey in Delphi Berlin they offer IntelligenceLab, AnimationLab, and LogicLab. IntelligenceLab consists of components with everything from classifiers, to converters, to filters, to generators, to timing components, to training components. These components could be used to build OCR applications, computer vision functionality, SPAM filters, AI, speech recognition, and decision making functionality. AnimationLab comes with three different components which are ALTimeline which allows you to manipulate components and their properties based on a timeline, ALMass which allows you to apply mass effects to Firemonkey 3D components, and ALDrag which allows you to apply drag effects. LogicLab allows you to simulate and display logic conditions using tools like logic operators, segment decoders, binary encoding & decoding, ALU & magnitude comparer, and more.

RiversoftAVG provides a number of component sets including SVG Component Library, Charting Component Suite, Genetic Algorithms, Fuzzy Logic, and Inference Engine Component Libraries.  The SVG Component Library allows you to Load, Edit and Save SVGs as SVG and Delphi Binary. Vector graphics are drawn at runtime which allows them to appear smooth regardless of the resolution and DPI of the device. The Charting Component Suite has over 19 different chart types which include area, arrow, pie, line shape, bubble, donut, candlestick, and graph to name a few. The Genetic Algorithms set is a powerful genetic algorithms and genetic programming solution. The Fuzzy Logic set has 29 different fuzzy hedges like addition, about, not, very, normalize, and many more. It does fuzzy correlation and inference. Finally, the Inference Engine is a powerful set of components which implement rule based intelligence and fuzzy logic.

Steema provides TeeChart Pro which is a charting component library that offers hundreds of Graph styles in 2D and 3D for data visualization, 56 mathematical, statistical and financial Functions for you to choose from together with an unlimited number of axes and 30 Palette components. Additionally, they have the Steema Business Intelligence component set which is open source and in active development. The SteeBI project is set to provide the an effective way for specialists and analysts to turn data into meaningful visualizations and reports.

TMS Software provides a massive number of Firemonkey interface and data exchange components. They include TMS Charts, TMS Cloud Pack, TMS FNC Chart, TMS FNC UI Pack, TMS Filters, TMS FlexCel, TMS Pack, TMS WebGMaps, TMS WebOSMaps, TMS iCL, and TMS mCL all for Firemonkey. There are all kinds of buttons, HTML components, charts, gauges, web browsers, maps, native controls, Excel components, cloud connections, and much much more. All of the Firemonkey components can be licensed as one giant Firemonkey Component Studio or each set can be licensed separately. Additionally, they provide a set of business components with ORM, scripting, workflow, REST/JSON libs, data replication, and data modeling functionality.

VIRT Laboratory’s paxCompiler provides an amazing set of Object Pascal, Basic, and Javascript scripting components. It is an embeddable compiler and interpreter engine that allows you to import the interface sections from your Delphi Berlin units and access the rest of your code from the interpreted script itself. You can access the main form of your application from the interpreted script for example. It also supports compiling executables on Windows and evaluating script at runtime. If you’re building any kind of scripting into your apps be sure to take a look.

WinSoft provides a huge number of individual components and library wrappers for accessing various devices like bar code recognition readers, the device cameras, COM ports, JDBC, DirectX Joystick, JSON files, CSV files, NFC, PDF, HID USB, and many more. Check each individual component for it’s device compatibility because they all vary across Android, IOS, OSX, and Windows. You can also get all of the components in one giant Winsoft Component Package.

Woll2Woll provides a versatile grid component suite called FirePower for all the Firemonkey platforms in Delphi Berlin which are Android, IOS, OSX, and Windows. It allows you to embed controls like buttons and images into the grid. It supports multiple columns and you can multiple select columns as well. It has seamless filtering and allows you to use in memory information from FireDAC and TClientDataSet. Records or cells can have custom fonts or custom colors for even more flexibility.

There are many more free and commercial Firemonkey components out there from other developers and vendors that we weren’t able to cover in this article.

Check out other Firemonkey posts to find out more about them!

Tags: , , , , , , , , , , , , , , ,

How To Guide For Developing Mobile Apps With Firemonkey On Android And IOS

If you are new to Delphi, new to Firemonkey, or new to mobile app development it can be a lot of information to take in all at once. Hopefully this guide will help you hit the ground running and accelerate your multi platform development with Delphi 10 Seattle. This information also mostly applies to Appmethod and C++Builder. The guide is going to cover video tutorials for building Android and IOS apps, integrating analytics, adding push notifications, working with IoT devices like Arduino and beacons, and finally on a more advanced level using enterprise services to really take your Firemonkey apps and Delphi deployments to a whole new level on Android, IOS, OSX, and Windows.

Delphi Android And IOS Overview

Learn about the Delphi development environment for mobile devices and all about the different sensors and functionality you have access to in this video. The video is for Delphi XE6 so also view the next video below to see the latest upgraded Firemonkey features in Delphi 10 Seattle.

Firemonkey Overview

Firemonkey is a rapidly evolving frame for development on Android, IOS, OSX, and Windows. Find out all of the newest features and functionality that are available in the latest version under Delphi 10 Seattle in this video.

Debugging Across Devices

Debugging applications across all the Android, IOS, OSX, and Windows platforms can be tricky. Learn how to effectively debug your multi device applications in this video.

Deploying Your Apps To Google And Apple

Developing your app can take some time but getting it deployed into the Google and Apple apps stores can be tricky. Learn how to setup and deploy your Android and IOS applications in this video.

Push Notifications

One way you can send information to your apps and keep your users engaged is to use push notifications. There are a lot of different ways to do this and it can be complex to support both Android and IOS methods. Learn how to use the Kinvey BaaS service to implement push notifications in this video.

Track Usage With Analytics

Use the analytics data to improve your apps instead of blindly developing new features. Learn to utilize the AppAnalytics component to start collecting data on how your users use your apps in this video.

Inter App Communication

If you are a long time Delphi developer and you have VCL applications that you want to get talking to Android and IOS devices or you just want all of your devices to easily communicate with each other you should take a look at AppTethering. Learn to use AppTethering for inter app communication in this video.

Talk To Arduino Devices

You can use Arduino devices for a variety of automation and sensor collection tasks. Learn how to use Delphi to talk to Arduino devices in this video.

Utilize Localized Geo Location

Integrate Beacons and beacon fencing into your apps for localized geo location services within buildings. Learn how to use the BeaconFence library to create localized events based on user locations with beacons in this video.

Quickly Deploy An Enterprise Cloud

Leverage the Embarcadero Enterprise Mobility Services cloud service to get your enterprise development up and running quickly. Learn how to create custom endpoints, implement push notifications, and create a custom login system in this video.

Ready for more? Dive right in with these hands on mobile app tutorials for Delphi 10 Seattle.

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

Top Ten Video Roundup Of Awesome Connected Devices Integrated With Firemonkey

Programmable and internet connected devices like the Arduino are exploding in popularity. There are quite a few videos on up YouTube showing fun integrations between Delphi and various bluetooth, wifi, and serial connected devices. Here are the top 10 Delphi device integration videos I’ve seen.

Some of them utilize Delphi XE8 Firemonkey apps on Android and IOS while others are simple Delphi 7 VCL apps using a COM port. There are three different Arduino integrations, two different drone integrations, a brain interface integration, a robot arm integration, a depth sensor integration, an animatronic head integration, an integration with beacons and mobile devices, and a gesture control integration. Three runner ups are listed at the end and they are a swimsuit integration, IP camera integration, and a temperature sensor integration.

Add your favorite Delphi hardware integration videos I’ve missed in the comments below!

#1 Animatronic Terminator Head Controlled Via A Delphi XE8 Android App

There are four different servo motors that control this creep animatronic head. Is that the Firemonkey light in his eyes?

#2 Delphi Firemonkey Android App Controlling LED Lights In The Room

This is a slick looking control interface for changing the room lights by sliding the colored bars in this Delphi app. Another similar video is here.

#3 Audience Member Controls A Drone Using His Brain Via Appmethod App And An Emotiv Headset

Nothing says this is the future like watching a guy fly a hovering vehicle with his mind. There is a second longer video with more explanation and background that you can watch here.

#4 Robot Arm Sketches Letters Via An Arduino And Delphi Control App

The Delphi app in this video is actually playing back a list of commends to create the sketch.

#5 Demonstration Of Accessing Microsoft Kinect Depth Data From Within Delphi

You can see the depth data made available via the Kinect SDK in this video. Includes sample source code.

#6 Ultrasonic Ping Pong Game Build In Delphi And Controlled Via An Arduino

This one is awesome because of the ultrasonic controllers. The Delphi and Arduino source for this integration is available in the YouTube description. The runner up to this video uses a knob but it also has a speaker (check it out here).

#7 Appmethod Control App Used To Pilot A Parrot AR Drone Around The Office

It’s hard to top a brain controlled drone but sometimes you just need the drone to go where you want and that’s where controlling it with a Delphi app comes in.

#8 Medical App Built In Delphi On Android And IOS Utilizes Check Ins Via Beacons For Distance

I believe the apps demonstrated in this video were covered in a webinar by Embarcadero and you can find all the resources for building the apps here.

#9 Appmethod Reads Data From A Myo Gesture Control Armband To Move A TRectangle

There is also a second video here where the armband is used to control a photo app in Delphi with gestures.

#10 Slick Looking Delphi App Used To Control An Arduino Via Wifi And Bluetooth

You can test out this app demo yourself and get the Arduino side of the source code here.

BONUS: Connected Swimsuits That Monitor (Via Delphi) How Much Sun They’ve Received

It isn’t quite clear how Delphi (or Appmethod) is used. I assume it is used by the sunlight monitoring device as the control app on a tablet or phone.

DOUBLE BONUS: IP Cameras And I/O Controllers Connected And Controlled Via An A Delphi Android App

This video is good but it is someone long as it contains a lot of technical details and a lot of connected devices. Really good showcase of technology.

TRIPLE BONUS: Read Temperature Data From An Arduino Device Using Delphi And Display It In An App

This integration with Delphi is achieved via simple serial port interface.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Ten Tips For Building Professional Multi Platform Enterprise Apps With Firemonkey

Delphi XE8 Firemonkey Android IOS OSX Windows TipsYou can utilize these tips when building Firemonkey apps with Rad Studio XE8, Delphi XE8, C++Builder XE8, and Appmethod for Android, IOS, Windows, and OSX devices.

#1. Secure And Compress Your Data Connections

In a mobile world it is more important than ever to secure and compress your data connections. Your users are hopping from hotspot to hotspot and switching between 2G, 3G, and 4G as they travel while using your apps. You never know how fast the data connection will be or who might be trying to snoop on your enterprise data. Delphi XE8 uses the platform native HTTP clients for it’s REST requests so that it’s SSL/TLS implementation is always up to date. You can secure other types of connections using SSH tunneling.

#2. Secure Your Local Databases With A Password

If you are deploying a local database like SQLite (or Interbase) with your app you can encrypt the local database by setting a password. Whether it is company enterprise data, user medical data, or even user photos encrypting your local database will help keep your app data and your user’s app data secure.

#3. Keep Your Mobile Apps Responsive With Native Progress And Activity Dialogs

It is never a good idea for your users to feel like your app is frozen while it does a calculation or loads some data. Using a native progress or activity dialog can keep your app fast and responsive while your app performs work in the main thread or even other threads.

#4. Check Network Connectivity Before Trying To Connect

With mobile apps especially it is always a good idea to check for a network connection prior to attempting to open a connection. Users on mobile devices can enter and leave connectivity at any time as they travel and your app should be built with this in mind. This applies to REST, app tethering, and straight TCP/UDP connections. Some mobile platforms (like IOS) even require that you make network connections outside of the main thread so utilize anonymous threads as much as possible.

#5. Keep The Focused Edit Field Visible Above The Virtual Keyboard

If the virtual keyboard pops up over your memo or edit control in the lower half of the device screen you will need to implement a solution to scroll the field into view. There is a demo included with the latest version of Delphi called ScrollableForm which demonstrates another way of doing it.

#6. Keep In Contact With Your Users Through Push Notifications

Whether you are sending an enterprise notification about a company event or notifying a user that they have a new message increasing user retention by utilizing push notifications can really help your app succeed. Push notifications are what allow you to re-connect with a user even though the user is not currently running your app. You can utilize the BaaS components in Delphi XE8 to implement push notifications through Parse and Kinvey or you can use a third party component which implements the Pushwoosh API.

#7. Use Premium Styles For A Professional Look

There are nine premium styles that come with Delphi XE8 Firemonkey and they can really give your app a professional look. Utilizing premium styles can also allow you to provide a light and a dark theme so your users can decide which works best in their lighting environment (Hint: the dark themes work great in full sun environments). Be sure to test out using gradients and images on your form backgrounds to really make these premium themes pop.

#8. Handle App Buttons And Lifecycle System Events

When building multi platform apps be aware of the different buttons and events available on each platform. You can handle the back and menu (VK_MENU in OnKeyDown and OnKeyUp events) buttons on Android devices so your users will have an intuitive flow inside of your apps. You can also utilize events like FinishedLaunching, BecameActive, and EnteredBackground to handle changes in your app’s lifecycle. There is also a bonus component called TfgApplicationEvents which gives you easy access to OnIdle, OnOrientationChanged, and OnStateChanged.

#9. Efficiently Display Data In ListViews With Custom ItemAppearance

The standard TListView component that comes with Delphi XE8 takes one-two lines of text (a title and a detail), an image, and an accessory icon on the right. If you want to display more lines of text in each item you will need to add a custom ItemAppearance. One of the custom ItemAppearances that can be installed supports 4 lines of text (a title and 3 details). Additionally, you can create your own custom ItemAppearances and add even more. Lastly you could also use a TListBox where you can embed any number of other controls within each TListBoxItem.

#10. Optimize Icon And Splash Screen Creation And Deployment

There are a lot of different icon sizes that you will have to create to support all of the different devices and device resolutions that are available. Each of the four major app stores (Google, Apple, Amazon, and Samsung) have their own icon size requirements. There is a free utility available which makes this easier or there is a free website which will generate icons as well. A second free tool will help you make all the splash screen images you need. When deploying to Android devices be sure to add your icon to the homescreen so user’s can easily find your app. Don’t have an icon yet? Check out this set of 750 free icons from Google.

BONUS TIP: Track Usage Of Your App And Exceptions With Analytics

Delphi XE8 comes with a TAppAnalytics component which allows you to see how users are using your app. The feedback you receive from analytics allows you to make smart decisions on how to iterate the next version of your app. You can add custom event tracking anywhere in your app and send exception information automatically to the server for review. Seeing exactly where users may be getting stuck or what features they use the most is gold. The TAppAnalytics feature is a cloud service with both a free tier and paid tiers. There is also a third party component that allows you to also track your app usage using Google Analytics. Both components require an internet connection.

DOUBLE BONUS: Take a deep dive into the inner workings of cross platform mobile apps built with Delphi XE8 Firemonkey.

Check out more tips for Delphi XE7 Firemonkey on Android, Delphi XE5 Firemonkey on Android, Delphi XE5 Firemonkey on IOS, building games with Firemonkey, debugging Delphi XE7 Firemonkey apps, and migrating from C# and .NET to Delphi.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Anatomy Of A Delphi XE8 Firemonkey App On Android, IOS, Windows, And Mac

Delphi XE8 Firemonkey Anatomy Of A Cross Platform App

If you are new to working with a full featured framework like Firemonkey you may be wondering at the size of the apps that Delphi XE8 Firemonkey generates. The Firemonkey Framework has hundreds of thousands of lines of code that allows you to jump ahead and start building the app you want to build now instead of the bricks in the road to get there. Hopefully this infographic will provide some insight into what makes up an APK/IPA cross platform application deployed from Delphi XE8 with the FMX framework. The infographic covers Android, IOS, Windows, and Mac OSX apps/packages/libraries/archives created using the Firemonkey framework. Tools that utilize the Firemonkey framework are Delphi XE8, C++Builder XE8, Rad Studio XE8, and Appmethod. The infographic only covers Release mode (something you could deploy to your customers). I have also included a VCL section in the infographic so that you can compare the Windows only VCL framework to the cross platform FMX framework. Also keep in mind that when you use debug information or are in Debug mode your file could be significantly larger. The sizes of the generated files are included in the green circles. There is the normal compiled size and then there is the compressed or packaged size. APK and IPA files are packaged and compressed. The compressed sizes for Windows and Mac OSX were achieved using the 7Zip format. Here is some information directly from the infographic as well about what units are included in a FMX app on Android (it is slightly different on each platform) and how those units effect the size of the deployable file.

Let’s start off with a Hello World app which is basically a FMX form with a TLabel on the form. This comes out to around ~4.97MB when deployed to Android as an APK. Even though this is a Hello World app there is already much more functionality here than just the ability to print out ‘Hello World’ to the screen. A true ‘Hello World’ would be much smaller because it would lack these Firemonkey framework units. The FMX and RTL units included are:

System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls

Next up I’ve listed what I call a Basic App  that clocks in at ~5.50MB. A basic app has some more visual controls available to it like a TListView, a TListBox, a TTabControl, a TMemo, and even some access to advertising. Here are the FMX units included (in addition to the units from the Hello World app):

FMX.ListView.Types, FMX.Objects, FMX.ListView, FMX.Edit, FMX.ScrollBox, FMX.Memo, FMX.Layouts, FMX.ListBox, FMX.DateTimeCtrls, FMX.Advertising, FMX.TabControl

This next tier of app size I’ve termed Services because it is basically some Android JAR files which when fully included bring the app up to around ~6.40MB. These services are basically helper services for Android (some of which are provided by Google) like Google IAP, GCM, and Analytics. You can include and exclude each of these files from your APK separately. Here is a list of the additional files:

android-support-v4.dex.jar, apk-expansion.dex.jar, cloud-messaging.dex.jar, google-analytics-v2.dex.jar, google-play-billing.dex.jar, google-play-licensing.dex.jar, google-play-services.dex.jar

Next up we have what I have termed the Consumer App style app tier which rings in at around ~8.91MB. Obviously if you add more or differently functionality the size of your app can fluctuate greatly. You could also build games and they might fall in this size range depending on how many external graphics and sound you used. This type of app includes more functionality like the RESTClient, the in app purchases unit, sensors, a grid component, and the camera component. Here are the additional FMX and RTL units included by the IDE when these new components (in addition to all of the above) were added:

IPPeerClient, System.Sensors, System.Rtti, FMX.Grid, System.Sensors.Components, FMX.Media,REST.Response.Adapter, REST.Client, Data.Bind.Components, Data.Bind.ObjectScope, System.Actions, FMX.ActnList, FMX.InAppPurchase

Lastly we have the Enterprise and Database App tier which comes in at around ~10.4MB+ but can increase size from here the more you add to your app. This includes FireDAC functionality for accessing an SQLite database, LiveBindings to bind the data to a grid, accessing various path utility functions, and creating ini files for settings storage. At this level you can add tens of thousands of lines of code and lots of forms and the app could still be around this size. The RTL and FMX units included when this functionality was added (in addition to all of the above units) are as follows:

System.IniFiles, System.IOUtils, FireDAC.Stan.Intf, FireDAC.Stan.Option,FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs, Data.DB, FireDAC.Stan.Param,FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, Data.Bind.EngExt,Fmx.Bind.DBEngExt, Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Grid, Data.Bind.DBScope, FireDAC.Comp.DataSet, FireDAC.Comp.Client, FireDAC.Phys.SQLiteVDataSet;

You can find out more about the Firemonkey Framework on the Embarcadero DocWiki and on the FiremonkeyX website.

Download the full Anatomy of a Firemonkey Framework Multi Platform App infographic for future reference.

Tags: , , , , , , , , , , , , ,

Ten Tips For Building Stunning Professional Android Apps With Firemonkey

#1. Secure Your App’s Data Connections With SSL

If you are using the REST client or the TIdHTTP component in your mobile apps you should encrypt your connection with SSL to keep your user’s data secure. You can utilize services like CloudFlare and MaxCDN to simplify implementing SSL on your web servers. Or encrypt your data manually with these free components.

#2. Reduce Your Mobile App Data Usage With Data Compression

With mobile service providers charging by the gigabyte lowering data usage is important. If you are making any kind of HTTP connection to a web server from your Firemonkey apps you should enable GZIP compression on both your server and client. There is also an open source compression library for files available.

#3. Save A Shortcut To The Home Screen After Install

If you want users to be able to find your app again after they first install it you should add your icon to the user’s home screen. The user can remove it or it will automatically be removed if they uninstall your app.

#4. Create And Deploy Icons For Your App

You will need to create quite a few different icon sizes to deploy with your app and to upload to the app stores. Each of the four major app stores (Google, Apple, Amazon, and Samsung) have their own icon size requirements. There is a free utility available which makes this easier. A second free tool will help you make all the splash screen images you need.

#5. Handle App Activate And Deactivate System Events

Take action when the lifecycle of your app changes in events like FinishedLaunching, BecameActive, and EnteredBackground. Users multitask using Android these specific system events (and others) will be fired. You should add these events to your app and take action as needed. There is also a bonus component called TfgApplicationEvents which gives you OnIdle, OnOrientationChanged, and OnStateChanged.

#6. Keep The Focused Edit Field Visible Above The Virtual Keyboard

If the virtual keyboard pops up over your memo or edit control in the lower half of the device screen you will need to implement a solution to scroll the field into view. There is a demo included with the latest version of Delphi called ScrollableForm which demonstrates another way of doing it.

#7. Keep Your Mobile Apps Responsive With Native Progress Dialogs

While your app is doing work that the user must wait for you should display a native progress or activity dialog to keep the app responsive. Your app will do it’s work in the main app thread (or your own custom threads) and the native progress or activity dialogs will animate seamlessly in the foreground.

#8. Check Network Connectivity Before Trying To Connect

You should check if a user is connected to the internet before making any opening any connections that attempt to connect using the internet. This way you can notify the user if they do not have connectivity and your app can handle that accordingly.

#9. Handle The Android Hardware Buttons

Android devices have a back button which you should handle so your users will have an intuitive flow inside of your apps. On Android devices there is also the VK_MENU button which you can handle in the OnKeyDown and OnKeyUp events as well.

#10. Automatically Save Form State Between Sessions

A new event is available in Delphi XE7 called TForm.OnSaveState which gets called when your app is going to be hibernated by Android. There is a free class helper available that will loop through the controls on your from in the OnSaveState event and save them out to JSON. When you form is created you can load up the previous saved form state.

BONUS TIP: Google Cloud Messaging Push Notifications

If you want to keep connected to your users and increase retention you can use push notifications. On Android there is a push notification API from Google called Google Cloud Messaging. It is pretty closely tied to Google and you have to have API keys but keeping connected to your users is worth it. Push notifications are similar to an email newsletter. You can also do push notifications through the BaaS components via Parse and Kinvey.

DOUBLE BONUS TIP: Apply Premium Styles For A Professional Look

Delphi XE7 comes with 7 premium styles for Firemonkey that look fantastic. You can give your users the option to choose which style they want to use at runtime. The Jet style works particularly well in direct sunlight.

Finally, check out the older version of this post for Delphi XE5. Check out twelve tips for IOS. And find out tips for building games with Delphi Firemonkey.

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

Ten Tips For Creating Professional Android Apps With Firemonkey

#1. Save A Shortcut To The Home Screen After Install

If you want users to be able to find your app again after they first install it you should add your icon to the user’s home screen. The user can remove it or it will automatically be removed if they uninstall your app.

#2. Secure Your App’s Data Connections With SSL

Users are connecting from public hotspots these days and you need to secure those data connections to keep the data safe. Some app stores like Amazon App Store will deny your app if you don’t use secure connections for your user’s login data.

#3. Create And Deploy Icons For Your App

You will need to create a good number of different icon sizes to deploy with your app and to upload to each different app store. There is a free utility available which makes this easier.

#4. Handle App Activate And Deactivate System Events

When users multitask using Android there are specific system events that will be fired. You should add these events to your app and take action as needed.

#5. Add An App Loading Splash Screen

Android apps can take a few seconds to load where the user may be confused on what your app is doing. You can set up a splash screen so the user sees your logo or something similar while your app loads. You can also try this new method of using the Android Manifest to add a splash screen.

#6. Keep The Focused Edit Field Visible Above The Virtual Keyboard

When the virtual keyboard pops up it will by default cover the box that is being edited if it is below the bottom half of the screen. You can scroll your form so that the field being edited stays visible.

#7. Use Progress Dialog Boxes To Keep Your App Responsive

If your app is doing a task which will take some time like downloading or saving a file you should show a progress dialog to the user so that your app doesn’t look frozen. You can use either a multithreaded, native dialogs, or single threaded dialog.

#8. Check Network Connectivity Before Trying To Connect

You should check if a user is connected to the internet before making any opening any connections that attempt to connect using the internet. This way you can notify the user if they do not have connectivity and your app can handle that accordingly.

#9. Handle The Android Hardware Back Button

Android devices have a back button which you should handle so your users have a correct flow inside of your application.

#10. Save Settings Between Sessions

You can use both TIniFile and TMemIniFile to save settings on Android just like you would on Windows. Be sure to use TPath.GetDocumentsPath + PathDelim to get the right location to save your Ini file to. A second way to save settings would be with SQLite.

BONUS TIP: Google Cloud Messaging Push Notifications

If you want to keep connected to your users and increase retention you can use push notifications. On Android there is a push notification API from Google called Google Cloud Messaging. It is pretty closely tied to Google and you have to have API keys but keeping connected to your users is worth it. Push notifications are similar to an email newsletter.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Polish Your Firemonkey Apps For IOS With These Twelve Tips

#1. Monetize With In App Payments And/Or Ads Like Admob And Iads

There are a number of free and commercial components which handle in app payments and ads for you on IOS with Delphi XE5 Firemonkey. Check out DPF for IOS which has both in app payments and Iads components for free. The other components are from JVESoft and from Flash AV Software.

#2. Secure Your App’s Data Connections With SSL

Users are connecting from public hotspots these days and you need to secure your data connections to keep your user’s data safe from snooping. You can use the free OpenSSL components with Indy or there are two other commercial SSL components here and here.

#3. Encourage Users To Rate Your App

Usually only people who want to give your app a low rating end up on the App Store rating page and rate your app down. In order for you to encourage users who also really like you app to rate your app you can use a component like this or build your own using dialog boxes. DPF for IOS has a free component and JVESoft has a commercial rating component.

#4. Create And Deploy Icons For Your App

There are around 30 different icon sizes that you need to create to handle both Iphone and Ipad icons with your IOS app. There is a free utility which will take your logo and turn it into all off the icon sizes that you need.

#5. Use Premium Styles In Your App

Embarcadero provided some additional premium styles which you can download and use with your apps. There is a dark style and a light style for both IOS6 and IOS7. You can provide both to your users and they can choose for themselves which one they like on your app best.

#6. Handle App Activate And Deactivate Lifecycle Events

The lifecycle events are really important on IOS (much more so than on Android). There is no functionality to exit your app on IOS so you need to use those backgrounding lifecycle events to take care of saving your settings etc.

#7. Add Google Analytics To Your App

If you are building a professional commercial app you will want to collect usage data so that you can find out how your users are using your app and use that data to guide how you upgrade your app and add new features.

#8. Keep The Focused Edit Field Visible Above The Virtual Keyboard

When the virtual keyboard pops up it will by default cover the box that is being edited if it is below the bottom half of the screen. You can scroll your form or tabcontrol so that the field being edited stays visible. Make sure to implement a version of the code that handles multiline edit controls like TMemo as well.

#9. Setup Apple Push Notifications

If you are building a long term commercial app for IOS one way you will want to keep in touch with your users is through Push Notifications. It is always easier (and cheaper) to re-connect with existing users than it is to get new users. Push Notifications can help your achieve that.

#10. Use Threads To Keep Your App Responsive

There is a multithreaded progress dialog which is the main link of this tip but in addition to that there are two native progress dialogs for IOS here. And there is the anonymouse thread unit called AnonThread which comes in the samples section of Delphi XE5 Firemonkey. You can read this blog post on how to use it. Lastly you can use the ExecuteAsync function with TRESTRequest to do asynchronous REST calls.

#11. Handle Device Idle Time Out

If you are doing any kind of downloading using your app you will want to handle the idle time out of the device so that your app doesn’t dim out and go into the background when it is actually working. You can disable the idle time out, finish your downloading, and then re-enable the idle time out to conserve the user’s battery.

#12. Check Network Connectivity Before Trying To Connect

With mobile devices your app could lose connectivity at any time as the user travels around while using your app. You need to build that connectivity detection in your app from the start so if connectivity does drop you can handle it gracefully either by queuing up actions or sending your users notifications that they need connectivity to continue.

Tags: , , , , , , , , , , , , , , , , , , , , , ,

Convert Delphi VCL Apps To Firemonkey Android And IOS Apps With Mida Converter

The Mida Team has released an updated version of the Mida Converter with support for Delphi XE6 Firemonkey. What Mida Converter does is take your existing VCL app and convert it to a Firemonkey app which can either be for desktop or mobile devices. There are quite a few new features in this release which look pretty useful for mobile developers building apps for Android and IOS devices. Mida Studio now supports the option to convert a VCL app to a mobile app and use either the DPF for IOS or the DPF for Android controls. What this might allow you to do might be to have one VCL codebase that you convert into Android and IOS versions that use the native components of each platform. It also might be easier to build a VCL app and then convert it to a Firemonkey app for IOS and target the DPF for IOS controls without having to build up the whole DPF IOS control setup yourself. It is also able to target the TMS iCL native components for IOS in addition to DPF. The new feature list claims it can do a total conversion from VCL to Firemonkey without having to add exceptions for specific components. It does mention however that single click conversion may not be possible with all applications because of the complexities involved. Some of the features that pertain to converting mobile apps are only in Mida Studio which is the more expensive version of this commercial utility.

Head over and read the full release notes for Mida Converter 4.2 on the Embarcadero forum. Or head directly to the Mida Converter website to purchase the utility and begin converting your VCL apps to run cross platform.

Tags: , , , , , , , , , , , , , , , ,