Learning & Support


iOS: Setup Push Notifications in Firebase (TP19+)

Twixl Support Team Updated: - Created :

    As of release 19.0, new Twixl apps can only use Google Firebase for sending out push notifications.

    We chose to adopt Firebase on both iOS and Android because of the flexibility it offers for more advanced users that want to build marketing campaigns across platforms in a unified way.

    Watch a video with step by step instructions

    1. Get Started

    1. Go to https://console.firebase.google.com/
    2. Signin with a Google Account, preferably but not necessarily the same one you use for the Google Play Developer account.

    2. Add a Project

    1. Click on Add Project. (You can also choose an existing project if you already created one before.)
    2. Choose a Project Name.
    3. Choose a Project ID or accept the proposed one.

    3. Add an iOS app to the project

    1. In Project Settings, select the General tab.
    2. Add an iOS app.
    3. Fill in the Apple Bundle ID (that should correspond to the Bundle ID in the build settings, a reverse DNS name like com.mycompany.myapp), and optionally specify an app nickname.
    4. Click Register to continue.
    5. Download the GoogleService-Info.plist file and save it. You'll need it later in your build setting on the platform.

    4. Configure your app to use Apple Push Notifications service (APNs)

    There are two ways to configure Firebase to connect to APNs: through the use of a private key that never expires, or through the use of certificates issued from Apple's Developer Portal. The approach of using a private key is the recommended way to configure Firebase for Twixl apps, because this key never expires.

    1. Follow the steps to create a p8 private key here. Write down the Key ID, the Team ID and download the key as a p8 file.
    2. Upload this p8 key to the Firebase console.
      1. Inside your project in the Firebase console, select the gear icon, select Project Settings, and then select the Cloud Messaging tab.
      2. At the bottom part of the page, select the iOS app.
    1. In APNs authentication key under Apple app configuration, click the Upload button.
    2. Select the saved key, and click Open.
    3. Add the Key ID and Team ID click the Upload button.

    5. Download the Service Account Private Key

    1. Click on the Gear icon next to 'Project Overview' (you can skip this step if you already configured Firebase for your Android app and uploaded the key to the Twixl platform).
    2. Select Project Settings.
    3. Select the tab Cloud Messaging API.
    4. Enable 'Firebase Cloud Messaging API' if it's not enabled yet (for new projects it will be enabled by default).
    5. Select 'Manage service accounts'.
    6. Click on the service account firebaseadminsdk-…
    7. Go to 'Keys', click 'Generate a new private key' and save the private key (a .json file). This key is the one that needs to be uploaded in the Push Notifications section on the platform.

    6. Upload the JSON Private Key to the Twixl platform

    1. (You can also skip this if you already configured push for Android): Go to the detail view of your app on the Twixl platform, then select Push Notifications from the side menu (under 'Advanced').
    2. Upload the Service Account Private Key (JSON) generated in the previous step.

    7. Configuring iOS push settings on the Twixl platform

    1. On the Twixl platform, go to your app, then navigate to the build settings section.
    2. In the build setting for your app, upload the Service Account File that you downloaded in step 2 (GoogleService-Info.plist) .

    8. Create a new build using the Twixl Publisher macOS app

    1. Create a build using the build setting you just updated. Install the build, via TestFlight (iOS), or directly on the device (Android).
    2. Start up the app, then exit it. Start up the app a second time. It should prompt for push notification permissions.
    3. You can register as a test device and send push notifications as documented here.

    9. What about push notifications for an existing app ?

    When you already have a Twixl app configured with Push Notifications, the existing configuration will continue to work through November 30, 2023.

    If you need to change the settings of the app, the only way to do so is to convert the push notifications setup to use Firebase, based on the documentation above. Note that to continue to use push notifications after November 30th, it is mandatory to move to Firebase.

    10. Testing Push Notifications on iOS

    To test push notifications, first create a build and upload it to App Store Connect.

    In the TestFlight tab there will be a list of all the builds uploaded. In the "Internal Testing" section it is possible to add a user that is a member of your App Store Connect team to test. Invite that member (possibly yourself) and they will receive an invitation e-mail from TestFlight to install the app. Use TestFlight on an iOS device to install the application.

    On the first run, the push notifications are not activated yet, so force quit the app and run it a second time. This time permission will be asked and the device will be registered to receive push notifications.

    It is possible to register as a test device. After that, on the Twixl platform, you can send the first push notification to this specific test device.

    If this works properly, then it is safe to assume the app is ready to be distributed and all users will be able to receive push notifications.

    Was this article helpful?

    0 out of 0 found this helpful