I’m just wondering, is all firebase code universal? For example If I code a firebase script in C++ can I use the same C++ code to access a database written in react native?
Related
I have been reading all through the documentation and through all of the other StackOverflow posts and am still not entirely sure if a react native expo app can have firebase analytics included or not.
I am not sure if I am supposed to use:
import * as Analytics from 'expo-firebase-analytics';
or
import analytics from "#react-native-firebase/analytics";
or if I am supposed to use googleServicesFile but I am using a web app so I don't have the file to download to add to the .pilist
I read this post and it doesn't look like it is possible: Is there any way to integrate firebase analytics into an expo react-native app without detaching?
but I also am reading through the expo documentation and it looks like it is possible: https://docs.expo.io/versions/latest/sdk/firebase-analytics/#expo-client-limitations--configuration
I am either getting errors thrown or no response when I write the events. So needless to say I am super confused. Any help would be appreciated.
i have to implement mixpannel analytics in one of my app.
i checked out Mixpannel officail site and react-native-mixpannel
but i'm struggling how to get started with it.
How to use it from scratch and what things i need for it like firebase
or not ?
Please suggest me some article or something else from where i can implement mixpannel anaylits to my react native app
Thanks
First of all did you use react-native init AwesomeProject or expo new?
With the first one you have access to the native code for iOS and Android.
For expo you have only the JavaScript files and you can't use this SDK.
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.
I have this database.
database
How can i get firstName in React-Native ?
It's simple in your case : use react-native-firebase
import firebase from 'react-native-firebase'
const ref = firebase.database().ref('users/fwDRY...G3');
const name = ref.get({ firstname: 'firstname' });
console.log(name.firstname)
Find yourself helpful from the docs: https://rnfirebase.io/docs/v5.x.x/database/reference/database
As React Native runs in Java Script thread on mobile platforms there are 2 ways to use it.
Using Web SDK, but it might be slower and is not as well integrated to the mobile operating system as native.
Using Native SDK for each platform. Using them manually on 2 platforms would require you to write React Native bindings for both platforms. Fortunately, the job has already been done. I highly recommend you to use this library https://github.com/invertase/react-native-firebase. It uses native APIs internally but exposes them into nice JavaScript API. It requires some setup but you won't work it around anyway regardless of the method chosen.
For example, to set it up for Android, you need to follow
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
https://rnfirebase.io/docs/v5.x.x/installation/android
https://rnfirebase.io/docs/v5.x.x/database/android
After you set it up, follow the link provided by frank-van-puffelen, https://firebase.google.com/docs/database/web/read-and-write#listen_for_value_events. The API on react-native-firebase is almost the same.
Is it possible to use "Callable Functions" together with AngularFire2?
Since AngularFireModule already calls initializeApp, I am not sure how to follow the instructions here?
I guess I should not call initializeApp() multiple times?
AngularFire2 is built on top of the regular Firebase JavaScript SDK. That means that anything that's possible in the JavaScript SDK, is also possible from within AngularFire2. If the action is related to showing data from Firebase in UI elements, there may be a wrapper from AngularFire. But even if there is no wrapper, you can access the JavaScript SDK directly.
So: Yes, it is possible to invoke Callable Cloud Functions from AngularFire2. You should indeed only initialize the app once, unless you're trying to access multiple projects.
If you're having trouble making this work, post the minimal, complete code that reproduces where you're stuck.