Show: Delphi C++
Display Preferences

FireMonkey Platform Services

From RAD Studio
Jump to: navigation, search

Go Up to FireMonkey Applications Guide


A platform service is a FireMonkey interface that defines some functionality that might or might not be implemented on a particular run-time platform.

FireMonkey implements many platform services, and you can implement your own platform services.

Using a Platform Service

To use a platform service, you must:

  1. Add a reference to the unit where your service is declared, such as FMX.Platform, to your unit.
  2. Call TPlatformServices.SupportsPlatformService with the target platform service as a parameter to determine whether or not the specified platform service is supported at run time.
  3. If SupportsPlatformService returns True, use TPlatformServices.GetPlatformService to access the actual platform service, and cast the returned service appropriately. You can alternatively use SupportsPlatformService to obtain the service as well.

For example, to access the clipboard service (IFMXExtendedClipboardService):

Delphi:

var
    ClipboardService: IFMXExtendedClipboardService;
begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXExtendedClipboardService, ClipboardService) then
    begin
        // …
    end;
end;

C++:

_di_IFMXClipboardService ClipboardService;
if (TPlatformServices::Current->SupportsPlatformService(__uuidof(IFMXClipboardService), &ClipboardService)) {
    // …
}

Built-in Platform Services

Unit Service
FMX.Advertising IFMXAdvertisingService
IFMXAdvertisingTestModeService
FMX.Clipboard IFMXExtendedClipboardService
FMX.Forms IFMXFullScreenWindowService
IFMXWindowService
IFMXWindowBorderService
FMX.InAppPurchase IFMXInAppPurchaseService
FMX.Maps IFMXMapService
FMX.MediaLibrary IFMXAudioManagerService
IFMXCameraService
IFMXImageManagerService
IFMXShareSheetActionsService
IFMXTakenAudioService
IFMXTakenImageService
IFMXVideoManagerService
FMX.Menus IFMXMenuService
FMX.PhoneDialer IFMXPhoneDialerService
FMX.Pickers IFMXPickerService
FMX.Platform IFMXApplicationService
IFMXApplicationEventService
IFMXCanvasService
IFMXClipboardService
IFMXContextService
IFMXDefaultMetricsService
IFMXDefaultPropertyValueService
IFMXDeviceService
IFMXDeviceMetricsService
IFMXDialogService
IFMXDialogServiceAsync
IFMXDialogServiceSync
IFMXDragDropService
IFMXGestureRecognizersService
IFMXHideAppService
IFMXListingService
IFMXListViewPresentationService
IFMXLocaleService
IFMXLoggingService
IFMXMultiDisplayService
IFMXRenderingSetupService
IFMXSaveStateService
IFMXScreenService
IFMXSystemFontService
IFMXSystemInformationService
IFMXTextService
IFMXTextEditingService
IFMXWindowsTouchService
FMX.Types IFMXCursorService
IFMXMouseService
IFMXTimerService
FMX.VirtualKeyboard IFMXVirtualKeyboardService
IFMXVirtualKeyboardToolbarService
FMX.WebBrowser IFMXWBService

Registering and Unregistering Platform Services

You can use TPlatformServices.AddPlatformService and TPlatformServices.RemovePlatformService to register and unregister platform services, respectively.

For example, you can unregister one of the built-in platform services and replace it with a new implementation of the platform service that is tailored to fit your needs.

See Also

Personal tools
In other languages
Previous Versions
Assistance