Firebase Cloud Messaging for mobile

Since there’s been a fair amount of interest with the 2-part article I wrote on using Firebase Cloud Messaging:

Part 1
Part 2

I’ve set up this page dedicated to the project, which will be updated as the respective Firebase SDKs are updated, and for any other issues that are found.

The starter project currently supports the following versions of the Firebase SDK:

iOS: Firebase SDK version 4.1.0
Android: Firebase SDK version 10.2.1 (aligns with Google Play Services)

Source:

If you don’t have the Kastri Free library (parts of which are required for the starter project), grab it from here.

If you’re just after the updated iOS support, this is the file you need.

Current configurations for the project: (these are just the configurations updated from the original articles)

Project Options:

Select Delphi Compiler in the tree, and select All configurations – iOS Device – 64 bit platform in the Target combo. In the Search Path option, you’ll need to add a path for each of the following (where <firebase> is the root of the Firebase SDK that you extracted):

<firebase>\AdMob\GoogleMobileAds.framework\
<firebase>\Analytics\FirebaseAnalytics.framework\
<firebase>\Analytics\FirebaseCore.framework\
<firebase>\Analytics\FirebaseInstanceID.framework\
<firebase>\Analytics\FirebaseNanoPB.framework\
<firebase>\Analytics\nanoPB.framework\
<firebase>\Analytics\GoogleToolboxForMac.framework\
<firebase>\Messaging\FirebaseMessaging.framework\
<firebase>\Messaging\Protobuf.framework\
<firebase>\RemoteConfig\FirebaseRemoteConfig.framework\

Required frameworks:

If you’re not already familiar with how to add other frameworks to the iOS SDK, you can refer to this article. You’ll need to add each of the following frameworks:

AdSupport
AudioToolbox
AVKit
CoreAudio
CoreMIDI
MediaToolbox
Metal
SystemConfiguration
UserNotifications

FireDAC issue:

If you’re using FireDAC with SQLite in your app, you’ll likely find that the app crashes on startup. It appears that FireDAC binds to SQLite static libraries that are incompatible with FCM. To alleviate this issue, please follow these steps:

  1. Make a copy of FireDAC.inc from the C:\Program Files (x86)\Embarcadero\Studio\xx.0\source\data\FireDAC folder, and put it in your project folder (where xx is the number for your Delphi install e.g. 18 for Delphi 10.1 Berlin)
  2. Modify FireDAC.inc to change the line:
    {.$UNDEF FireDAC_SQLITE_STATIC}
    Remove the “.” after the “{” so that it becomes:
    {$UNDEF FireDAC_SQLITE_STATIC}
  3. In Project Options, select: All configurations – iOS Device- 64 bit platform, and add the following to the search path:
    $(BDS)\source\data\FireDAC
  4. Clean and Build the project (as opposed to Compile), run it, and all should be OK