React-Native Firebase custom events not showing in DebugView mode on iOS - firebase

So I followed all the instructions, installed the library and linked it with react-native link react-native-firebase
Added the correct code in my AppDelegate.m with my GoogleService-Info.plist file added in my XCode project.
I also added -FIRAnalyticsDebugEnabled and -FIRDebugEnabled in the Arguments Passed On Launch like the documentation said.
Events like: user_engagement and first_open are showing correctly so I'm guessing that my config is OK, but my custom events aren't showing at all in the DebugView.
In React-Native-Firebase documentation it says
The default app is pre-initialized natively therefore there is no need to call initializeApp for the default app instance.
But in this example that I tried to follow, he uses initializeApp with for parameter debug: false so that events show up.
Code that I tried:
import RNFirebase from 'react-native-firebase';
const firebaseApp = RNFirebase.initializeApp({ debug: false });
firebaseApp.analytics().logEvent("test_event");
I did the same thing and it's not working at all. What is the correct syntax to send events on DebugView? I'm a little lost here. Thanks!
I'm using RN: 0.52.0

Related

firestore is not working with React Native Expo

I installed firebase with react native expo using expo add firebase, then
I created a file (firebase.tsx) and added the Firebase configuration and initialized the app like in this screenshot with correct values].
I have added the google-services.json and
GoogleService-info.plist to the root of my expo project like the documentation say and i am importing firebase in my api service like this import Firebase from './../../../firebase'.
In my register function I call the firebase create user function
const response = await Firebase.auth().createUserWithEmailAndPassword(values.email.value, values.password.value)
The response is never returned, and if I use . then nothing happens either.
If I log firebase.auth I get an object with my API key and app name, etc. so Firebase is installed, but whenever I call the database for sign in or to access a collection nothing happens.
This is my package.json.
This is my app.json.
I added bundleIdentifier and googleServicesFile to iOS and package and googleServicesFile for Android.
currently Firebase seems not to be working in expo if you are using the android configuration. I have tried the web configuration and it has worked for me. Here is the youtube tutorial for it. Watch from 38:20 to set up.

Firebase Crashlytics React Native: Not able to understand stacktrace

So I am getting this [see Image] as a stacktrace after integrating react-native-firebase and I am able to understand it. Message is correct "undefined is not an object". But Line Numbers are missing. This is no file name.
If there is any way I can upload react native bundle to firebase to make it more understandable.
Already read
React Native Firebase Crashlytics Deobfuscation
Can't do this for every crash.
If the functionality is not available on firebase please comment. If the integration was wrong please let me know.
I am using these versions
"#react-native-firebase/app": "^12.0.0",
"#react-native-firebase/crashlytics": "^12.0.0".
And
firebaseCrashlytics {
mappingFileUploadEnabled true
}
is enabled for release flavour.
Checking these issues on release build.

FirebaseError: Analytics: "measurementId" field is empty in Firebase config

I cannot start project with yarn run dev and have this error:
FirebaseError: Analytics: "measurementId" field is empty in Firebase config. Firebase Analytics requires this field to contain a valid measurement ID. (analytics/no-ga-id).
I deleted yarn.lock file, added some extra variables to.env file. Where can I find measurementId? What might help in this kind of error? May be somebody have already faced with such problem. Thanks :)
This has nothing to do with your yarn lock file. Which client side sdk are you using for Firebase? Angularfire perhaps?
I assume you did put your firebase config in your environment file of your angular app. Just add the property "measurementId" to it with the correct value, and you are good to go. You can get this property in your Firebase project.
If your app uses the Firebase hosting and uses reserved URLs you are good to go since it automatically handles the configuration for your application. It seems it isn't your case.
You should add or update the config file to ensure the measurementId field is present. To find the config file go to Your apps card in your Project settings from the Firebase Console.
It can be useful as well: How to get the measurementId from the Firebase config?

Implementing Firebase Crashlytics in React native application - Android

I want to add Firebase Crashlytics to my React native project. I had a look online and some of the links suggested using Crashlytics with Fabric,
When I looked at Fabric and at somepoint it was mentioned that it was only available till 2020 and recommended to use Firebase Crashlytics. I am a bit confused.
Can any one suggest any link/guide to implement Firebase Crashlytics in my React native project.
Thanks
R
Its kind of simple.
First you need to add firebase to your project use the following link to link react-native-firebase .
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
Then use there doc to add firebase crash analytics into your code
https://rnfirebase.io/docs/v5.x.x/crashlytics/reference/crashlytics
for example:
import firebase from 'react-native-firebase'
componentDidMount(){
firebase.crashlytics().log('Test Message!');
firebase.crashlytics().recordError(37,"Test Error");
}
Add firebase to your project followed by crashlytics sdk. You might need to put the keys in your android and ios projects. Thts it.
Also have a look at sentry- its more suitable for JS based apps as it shows the line nos and the code which caused the crash. Crashlytics on the other hand as i remember shows only native crashes.

React Native Firebase not Off-line

So guys I have my app working 100% with Firebase and react-native but the problem is if I try to disconnect the internet the app don't get cached information.
On official Firebase says that firebase works with local storage cache and provides off-line information, but how?
If you are using JavaScript SDK, it will not work on mobile apps.
To achieve this feature, you have to add react-native-firebase, which is an abstraction of JavaScript SDK to both iOS and Android SDK.
https://rnfirebase.io/
After adding it to your project, you can setup the following config:
Android
Add FirebaseDatabase.getInstance().setPersistenceEnabled(true); inside
your MainApplication.java files onCreate() method.
You also need to explicitly add the FirebaseDatabase import with the
rest of the imports near the top of your MainApplication.java file:
import com.google.firebase.database.FirebaseDatabase;
iOS
Add [FIRDatabase database].persistenceEnabled = YES; after the [FIRApp configure]; line inside your AppDelegate.m files
didFinishLaunchingWithOptions method.
Source: https://rnfirebase.io/docs/v3.2.x/core/default-app#Enable-Database-Persistence
Also, if you want to trigger any event when the user lost connection, you can use onDisconnect listener: https://rnfirebase.io/docs/v4.2.x/database/reference/OnDisconnect
Hope it helps

Resources