Forge Component
(20)
Published on 26 May (2 days ago) by Patrícia Glória Ferreira
20 votes
Published on 26 May (2 days ago) by Patrícia Glória Ferreira

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

Hi David Sousa,

I followed all steps as you mentioned but I have faced issue to implement firebase plugin please check below url for more info.

https://www.outsystems.com/forums/discussion/57396/error-installing-cordova-plugin-firebase-typeerror-path-must-be-a-string/

Hi Swapnil,

If you look at the error log, no configuration file was found:

David Sousa wrote:

Hi Swapnil,

If you look at the error log, no configuration file was found:


Hi David,

Thanks for your reply.!

I did mistake in configuration firebase. Now its working fine for me.

But because of firebase google siginin functionality is not working.

without firebase its working.

Hi, we tried to use Firebase Mobile 1.0.4 on Outsystems 10 with MABS version 6.1 and change Extensibility Configuration to https://github.com/TruewindIT/cordova-plugin-firebase#1.9 . It working fine on Android but on IOS we keep getting an error:


We already contacted OS Support regarding this issue and they recommend to contact the creator of this App. Hope we can get a possitive response on this.

Thank You and Best Regards,

PJ Cezar

Hi Paul John Cezar,

Kindly post a new thread on Support of the Same plugin :)

Perhaps coming to your question the version Version 1.0.4 is compatible with OS-10.

Don't change the configuration otherwise, there's no meaning of using a standard version of this plugin.


assif_tiger wrote:

Hi Paul John Cezar,

Kindly post a new thread on Support of the Same plugin :)

Perhaps coming to your question the version Version 1.0.4 is compatible with OS-10.

Don't change the configuration otherwise, there's no meaning of using a standard version of this plugin.



If I didnt change the Extensibility Configuration I'm getting an error both IOS and Android. It seems that MABS 6.1 is compatible on that version ( https://github.com/TruewindIT/cordova-plugin-firebase#1.9 ). I will create a new thread for this I just thought going directly here will have a faster response.


Thank YOu

Hi Paul,

From what I see in your build error, you're missing the Firebase configuration file. Did you follow the configuration guide?

You can use the latest component version (1.0.7) since it's backwards compatible with OS10.

Regards

David Sousa wrote:

Hi Paul,

From what I see in your build error, you're missing the Firebase configuration file. Did you follow the configuration guide?

You can use the latest component version (1.0.7) since it's backwards compatible with OS10.

Regards

Hi Sir David,

Can you identify what file did I miss? I follow every step. I'm badly needed this one to be done by tomorrow.

1. Download IOS and Android config file.

2. zip two files, and name it google-services.zip.


3. see image below:

Paul,

Can you please share the module so that I can take a closer look at what might be the problem?


David Sousa wrote:

Paul,

Can you please share the module so that I can take a closer look at what might be the problem?


Hi Sir David,

I jsut shared the project. Just to confirm after downloading the file no other configuration will be done on Firebase Console right? 


Thank You


Paul,

I was able to generate your application on my personal environment.

Can you please confirm that your app identifier matches the one you chose on Firebase? 

On the Firebase console, after downloading the configuration files, nothing else is needed from a configuration perspective.

David Sousa wrote:

Paul,

I was able to generate your application on my personal environment.

Can you please confirm that your app identifier matches the one you chose on Firebase? 

On the Firebase console, after downloading the configuration files, nothing else is needed from a configuration perspective.


Hi Sir David,


Generated IOS and Android  successfully Sir? using Firebase Mobile 1.0.4 with MABS 6.1 on Outsystems 10 ? Yes, I just copied the App Identifier on service studio. Please see pic below.



Thank You



Paul,

Why are you using the version 1.0.4 of the component?

I generated using MABS 6.1, Outsystems 11 and the latest component version.

I'd say that the Outsystems version doesn't affect the app generation, since that process is done on MABS, but I'm not entirely sure.

I advised him on a thread with the below solution & I guess it should work.

Considering he is using OS-10 :

FirebaseComponent : 1.0.7

MABS: 6.0 or 6.1

Extensibility Configuration:  https://github.com/TruewindIT/cordova-plugin-firebase#1.9

David Sousa wrote:

Paul,

Why are you using the version 1.0.4 of the component?

I generated using MABS 6.1, Outsystems 11 and the latest component version.

I'd say that the Outsystems version doesn't affect the app generation, since that process is done on MABS, but I'm not entirely sure.

Hi Sir David,

I'm using Outsystem 10 with MABS 6.1. That's the recommendation of Outsystems Support to use version 1.0.4 since 1.0.7 is version for Outsystems 11 so we trying to use the lower version instead, but it prompt same error.



Thank You





assif_tiger wrote:

I advised him on a thread with the below solution & I guess it should work.

Considering he is using OS-10 :

FirebaseComponent : 1.0.7

MABS: 6.0 or 6.1

Extensibility Configuration:  https://github.com/TruewindIT/cordova-plugin-firebase#1.9


Hi,


for 

FirebaseComponent : 1.0.7

MABS: 6.0 or 6.1

Extensibility Configuration:  https://github.com/TruewindIT/cordova-plugin-firebase#1.9 


It prompt error: "An unexpected error has occurred while generating your application. Please try again. If the problem persists, contact OutSystems Support.


As I said earlier, we already contact Outsystems Support and they recommend to use the lower version (1.0.4) instead of (1.0.7) but it prompt same error.



Thank You