Mobile Development

36.1 Setup

Android: the SDK/NDK (installed by RAD Studio), a device with USB debugging, or an emulator. Target Android 64-bit (required by Google Play). AAB format for the Play Store.

iOS / macOS: a Mac with Xcode, PAServer running on the Mac, an Apple developer account, provisioning profiles, and certificates.

36.2 Mobile-Specific APIs

Component / API TLocationSensor, TMotionSensor, TOrientationSensor Camera / photos

TCameraComponent, TTakePhotoFromCameraAction, TTakePhotoFromLibraryAction

TNotificationCenter (local), push notifications (FCM/APNs via TPushEvents, Kinvey/RAD Server) TMapView (Google Maps / Apple Maps)

TPath.GetDocumentsPath, SQLite via FireDAC, TPreferences-style INI in the documents path

IFMXApplicationEventService (BecameActive, EnteredBackground...)

IFMXVirtualKeyboardService, TVertScrollBox + OnVirtualKeyboardShown TBannerAd (AdMob)

JNI bridge (Androidapi.JNI.*, TJavaClass), Objective-C bridge (iOSapi.*, TOCGenericImport)

uses System.Permissions, FMX.DialogService, System.Sensors, System.Sensors.Components, FMX.Platform;

// Runtime permissions (Android)
PermissionsService.RequestPermissions(['android.permission.CAMERA'],
  procedure(const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray)
  begin
    if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then
      CameraComponent1.Active := True
    else
      TDialogService.ShowMessage('Camera permission denied');
  end);

// Location
procedure TMainForm.LocationSensor1LocationChanged(Sender: TObject; const OldLocation, NewLocation: TLocationCoord2D);
begin
  lblLocation.Text := Format('%.5f, %.5f', [NewLocation.Latitude, NewLocation.Longitude]);
end;

36.3 Deployment

Project → Deployment Manager (files to include). Configure the version info, icons and launch screens, AndroidManifest.template.xml, entitlements (Entitlement List), and the Uses Permissions list.

Builds: Debug, Release/Application Store, Ad Hoc (iOS), Google Play (AAB). Sign with a keystore (Android) or certificates (iOS).