Brian Long has a new blog post up which explains handling Android callbacks with Firemonkey in Delphi 10 Berlin. If you are doing Android programming, you are surely familiar with the callback system that handles either the events from an intent filter or passing of data between Activities. Obviously this is only for Android and not IOS, OSX, or Windows. In previous versions (Delphi XE5, XE6 and XE7), you had to deal with custom Java code, custom activity sub-classing and other boilerplate code. But with the new Delphi Berlin, the callbacks are picked up by the FireMonkey activity’s onNewIntent method and sent into the RTL cross-platform messaging system. You can write your own code to process the new intents. This intent messaging is done via an additional use of the Android-specific TMessageReceivedNotification message (these messages contain an instance of JIntent then wraps and Android intent). It is IFMXApplicationService, that provides cross-platform access to event notifications so that you do not need to use a different, platform-specific event system on each platform that your application targets. When IFMXApplicationService receives an event notification from the operating system, it generates a message object (TMessage or one of its descendants) to provide the event data. The message object contains read-only information about the event that occurred. Thus, with Delphi Berlin it is now simpler to handle the intents received from hardware (camera, bar-code scanner, or any other device), no boilerplate code, easier debugging.
FMXExpress.com has over 700 tips and tricks for building cross platform apps on Android, IOS, OSX, Windows, and Linux with a single codebase and single UI using the FireMonkey framework found in Delphi and C++Builder.
FMXExpress covers top cross platform secrets for FireMonkey in C++Builder and Delphi XE5, XE6, XE7, XE8, Seattle, Berlin, Tokyo, Rio, and Sydney.