Forge Component
(18)
Published on 4 Nov by David Sousa
18 votes
Published on 4 Nov by David Sousa

In order to configure Firebase Mobile, follow the next steps:


1. Firebase project and configuration files

First of all, go to the Firebase console and create a project if you don’t have one already:


Add a new Firebase app for each mobile operating system your app supports. Since OutSystems allows us to build native apps for Android and iOS, let’s add both. When adding each Firebase app use the app identifier obtainable from Service Studio.

Add the Android app. Register the app in step 1 and download the configuration file in step 2. You can safely skip steps 3 and 4.

Store the Android configuration file (google-services.json) since we'll be using it shortly.


Add the iOS app. Register the app in step 1 and download the configuration file in step 2. Safely skip the remaining steps.

Again, store the iOS configuration file (GoogleService-Info.plist).



2. Setting up the configuration files

Now that we have both configuration files, let’s add them to your mobile app.

First of all, create a zip file containing both google-services.json and GoogleService-Info.plist.

Next, rename your zip folder google-services. Make sure it only contains both configuration files!



3. Adding the configuration files to your mobile app

Afterwards, add it to the Resources tab of the mobile app in Service Studio.

Ensure that the following properties are correct:

  • Name: google-services.zip
  • Deploy action: deploy to target directory
  • Target directory: concatenation of firebase. and your app identifier.

Example of target directory:

  • App identifier: com.sample.dev.FirebaseMobileSample
  • Target directory: firebase.com.sample.dev.FirebaseMobileSample


After this step you’re ready to publish your application. When you open it, it’ll be registered with Firebase!




Support to multiple environments

If you’re wondering why we have to configure the “target directory” of the configuration files to include the application identifier, that’s because we need to support having Firebase in a multiple environment scenario.

Check the following example:

  • We have 3 environments (DEV, QA and PROD)
  • As expected, our app has a different app identifier in each environment
  • Also, we'll have a Firebase project per environment, which means we'll have different configuration files per environment

After configuring the Firebase projects and setting up the configuration folders for the 3 environments, we'll add them to the app Resources tab in the lowest environment, in this case DEV.

You can now safely deploy your application with Lifetime to the upper environments.

The plugin will then pick the correct folder when the app is built and apply the right Firebase configurations to your app.


Hello.

And if I have for dev, two different app id, one for ios and one for android. 

What I should add in target directory?


Thank you in advance

Solution

Hi Camila,

In your case you can follow the next steps:

  1. define two zip folders, one for Android and other for iOS, each with the respective configuration file inside
  2. both folders should be named google-services.zip
  3. add both folders to the resources tab in Service Studio
  4. define the target directory for Android with the Android app id, like firebase.<android_app_id>
  5. define the target directory for iOS with the iOS app id, like firebase.<ios_app_id>

Regards,

David


Solution

Works. Thank you, David!

Hi guys,

Someone can help me? I do not understand the reason for this error.





Kind regards,

Nuno Verdasca

Hey Nuno,

I'm afraid that isn't a problem with the plugin. Can you try to publish the Firebase Mobile Sample espace and check if that error persists there?

Regards,

David

Hi David,

In your documentation you say

"The plugin will then pick the correct folder when the app is built and apply the right Firebase configurations to your app."

Can you please point me to where you have that code in your plugin as I wanted to see how the plugin picks up the right environment specific google zip file.

Thanks,

Mir


Hi David,

I have added Cloudnotification block in my HomeScreen and added Event Handler to that .But when i send notification from firebase console i am not receiving notification.,  let me know what i am doing wrong.


Thanks

Harish

HI Everyone. 

the plugin doesn't work for ios 13.1.1 is there any additional step needed to be done?


Regards,

Anahit