Skip to content

Latest commit

 

History

History
166 lines (107 loc) · 8.83 KB

File metadata and controls

166 lines (107 loc) · 8.83 KB
summary Use the Firebase-based plugins Analytics, Crashlytics, and Performance to implement common development patterns in your mobile apps.
tags article-page; runtime-mobile; support-application_development; support-Mobile_Apps; support-Mobile_Apps-featured
locale en-us
guid 188c9757-ce29-4f78-9717-4e42226e0a4d
app_type mobile apps

Firebase Plugins

Applies only to Mobile Apps.

Firebase is a Google mobile development platform. It speeds up development of many development patterns for mobile apps. You can use Firebase in the OutSystems mobile through the following Firebase-based plugins:

To migrate your app from the unsupported Firebase Mobile plugin, see Migrating to the supported Firebase-based mobile plugins.

Prerequisites

To use the Firebase plugins you meet the following requirements:

Demo app

Install Firebase Mobile Sample App from Forge and open the app in Service Studio. The demo app contains logic for common use cases, which you can examine and recreate in your apps. If you want to build the app and run it, check the prerequisites in the Forge page.

Adding and using a Firebase plugin

To add a Firebase plugin to your module, follow these steps:

  1. Install the plugin and reference it in your module. See Adding plugins for detailed instructions.

  2. Add the Google services configuration file to the module.

    You need to add Google services configuration file only for the first Firebase plugin in your module. The next Firebase plugin you add uses the same configuration files.

  3. In Service Studio, go to Logic > Client Action > your Firebase plugin and use the actions in your logic.

    Firebase actions in the logic tab of Service Studio

Adding Google services configuration file

An app with a Firebase Plugin requires the plugin configuration files in the app file resources. Follow the steps to add the Firebase configuration to your module:

  1. In Service Studio, go to the Data tab.

  2. Right-click the Resources folder and select Import Resource. The Import Resource dialog opens.

  3. Select the google-services.zip firebase configuration file and confirm the selection. Service Studio adds the file under the Resources folder.

    Resources folder in Service Studio

  4. Select the google-services.zip resource and configure the following:

    Resource settings for Firebase

  5. Repeat steps two and four for each environment, each time using a different configuration and target directory.

    Resource settings for Firebase

Preparing Firebase configuration file

Add the files GoogleService-Info.plist and google-services.json in a zip file and name the zip file google-services.zip.

Configuration files in a zip archive

Generating target directories for configuration files

A Firebase Plugin requires that you supply configuration files in the app file resources. The mobile apps commonly have different identifiers in different environments, so you need to generate target directories for each environment.

To get the target directory, concatenate the app identifier and .firebase. Here are examples for three environments with different app identifiers.

Environment App identifier Target directory
DEV com.sample.dev.MyApp com.sample.dev.MyApp.firebase
QA com.sample.qa.MyApp com.sample.qa.MyApp.firebase
PROD com.sample.prod.MyApp com.sample.prod.MyApp.firebase

Use the target directory value in the Target Directory property of the Resource.

Additional setup for the Dynamic Links Plugin

Firebase Dynamic Links is being shutdown by Google on August 25th. You can check more info [here](https://firebase.google.com/support/dynamic-links-faq#:~:text=FAQ%20further%20below.-,When%20will%20Firebase%20Dynamic%20Links%20stop%20working%3F,Dynamic%20Links%20will%20shut%20down.). OutSystems has deprecated this plugin and will also shut it down on August 25th. If you are using Firebase Dynamic Links for deep-linking, OutSystems is assessing the possibility of providing a supported solution for App Links and Universal Links.

The Firebase Dynamic Links Plugin has some additional setup steps that need to be followed for it to work correctly:

  • You need to include a global preference in the Extensibility Configurations of the application using the plugin. The value for this preference needs to match the URL prefix you set in the Dynamic Links page in the Firebase console. For example:

    {
        "preferences": {
            "global": [{
                "name": "FIREBASE_DOMAIN_URL_PREFIX",
                "value": "outsystemsfirebase.page.link"
            }]
        }
    }
  • For iOS, you need to use a provisioning profile from Apple that contains the Associated Domains capability. For more info, see Configuring an Associated Domain by Apple.

Ensuring app is compliant with Apple’s Data Use and Sharing guidelines

Starting with iOS 14.5, apps on the App Store must receive the user’s permission to collect tracking data through the AppTrackingTransparency framework.

RequestTrackingAuthorization client action parameters on Service Studio

To trigger the native AppTrackingTransparency framework, use the RequestTrackingAuthorization client action from the Firebase Analytics Plugin. Apple reccomends triggering this prompt as soon as the app loads. If you want to present an alert prior to the iOS tracking permission dialog, enable the ShowInformation parameter on the action. To provide more context to app users in the dialog, set a Title and Message.

By default, the NSUserTrackingUsageDescription field is set to AppName needs your attention.. You can set your custom description by including an iOS-specific preference (USER_TRACKING_DESCRIPTION_IOS) in the Extensibility Configurations of the application, as follows:

{
    "preferences": {
        "ios": [{
            "name": "USER_TRACKING_DESCRIPTION_IOS",
            "value": "This is an example of a description."
        }]
    }
}

You can use the RequestTrackingAuthorization action multiple times in the same app, since iOS remembers users' choice and only prompts users again after they uninstall and then reinstall the app on the device.

By default, an app using the Firebase Analytics plugin is able to trigger the native AppTrackingTransparency framework. It also contains the NSUserTrackingUsageDescription field in the app's *-Info.plist file. If you don't want to trigger the framework, and don't want to include the description field in the .plist file, you can disable this through the Extensibility Configurations like this:

{
    "preferences": {
        "ios": [{
            "name": "EnableAppTrackingTransparencyPrompt",
            "value": "false"
        }]
    }
}

It is important to note that if your app collects user data for adversiting purposes, also know as Attribution within Firebase Analytics context, it should prompt the AppTrackingTransparency framework.