Using Firebase Analytics inside our android SDK - firebase

We're building SDK for Android apps which hopefully be used inside many android apps.
We need analytics both for ourselves and for the companies who would implement our SDK.
Does it make sense to implement firebase analytics inside our SDK in order to achieve this requirements?
(I know that it works with big query so I thought I might be able to gain lots of value from it.)
Is it even possible? (because of the JSON needed for the hosting app)
If it does make sense, what I really need is a list of pros and cons for using it in this scenario.

You can integrate Firebase Analytics within your app, then track who uses your SDK by logging a custom event and parameters or any other information that you need.
Note that custom parameters are not directly displayed in your Analytics reports, however you can link your app to BigQuery to see these data.

As of now, this is not possible.
There is an issue created for this on Github.
https://github.com/firebase/firebase-android-sdk/issues/66
Initialize FirebaseApp without google-services.json
FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId(applicationID) // Required for Analytics.
.setApiKey(apiKey) // Required for Auth.
.build();
FirebaseApp.initializeApp(context, options);
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
tools:node="remove"/>
But the replies says as below:
Google Analytics for Firebase (GA4F) doesn't support dynamic
initialization. Our engineers are checking the possible solutions to
support this. It's just that we still haven't found a definite
timeline as to when (or if) this will be available. GA4F will not work
without the google-services.json file (or Gradle on your end). Even
though you can initialize the FirebaseApp dynamically through code,
GA4F will not recognize this and will only result in the error message
you are seeing. The scenario you are getting is only specific to
Google Analytics for Firebase. However, you can still use other
products like Firestore, Realtime Database, Storage even if you are
not using Gradle plugin.

Related

Using both Firebase and Amplify in one React native App

There is a big debate on the internet about Firebase vs Amplify. Get that. What I dont get is why so little to noone actually considers using both, or nobody just writes about it. To me both have clear advantages in different fields:
Firebase definitely seems to be handier when it comes to analytics and push notifications , AWS doesnt even offer ads as far I as know. And Pinpoint is quite confusing in its documentation.
AWS Cognito make more sense to anyone using AWS Services for the backend.
Firebase also offers all analytics and messaging for free regardless of the amount of data, whereas in AWS as usual you are hooked in right away with more AWS services. Firebase Storage is also more expensive than AWS once you have some significant traffic.
So I was thinking why not using Amplify SDK for Cognito and S3 whereas Firebase SDK takes care of analytics, Push Notifications and Ads. I dont see any disadvantages myself, but again - i have never built a mobile app, I am a pure backend developer. Can anyone come up with problems of this setup or just confirm it is absolutely fine?
Thanks!
ps. i am thinking of an app written in react native
I'm early into very similar research, so take this information with a grain of salt.
Regarding push notifications, Amplify's documentation for Android includes either setting your app up in Firebase or using Pinpoint. This documentation can be found here:
Amplify Push Notifications - Getting Started
This appears to be a direct tie to Firebase's push notification functionality, so I don't believe you'd get any of the other features Firebase offers with this implementation.
Regarding the other features, I believe your assessment is correct in that whichever deployment toolchain you choose to use you're subject to their analytics options.
I am also working on something similar and have always wondered why there isn’t more out there on this subject. Leveraging the best from both seems like the next step when looking to implement either.
Did you come across any issues?
I’m using Firebase SDK for Authentication, Auth, and Firestore (albeit will probably switch to S3 for storage). Amplify for everything else. NextJs frontend, no mobile.

Should I make a RESTful API using Cloud Functions or call Firebase and Firestore in app?

I am currently creating a marketplace mobile application from scratch and I'm using React Native for the front-end part and Firebase for the backend (using Firebase and Firestore).
I am wondering wether :
I should create a RESTful API using cloud functions and express to create API endpoints (that would connect to firebase and firestore) that I'd call from my redux actions in my React Native app (using redux thunk).
or, I should call firebase and firestore directly from redux actions.
I see couple pros and cons for each method.
Restful API pros :
Safer as I can check and manipulate submitted data more easily
Custom API reply (I can manipulate the return data)
Restful API cons :
Probably slower as I would have to call an API endpoint that will then call firebase and/or firestore.
Won't be as easy to set listeners on firestore data
What do you think about it ?
Which option should I choose knowing that I predict that the app will get a few thousand users daily. I want it to be as fast and safe as possible and be able to set listeners for notifications purposes.
In my opinion you should mix them, if you have to manage users, products or etc. Firebase produces client and admin sdk that has different roles. If you haven't need manage any data of products or users or etc. you can simply use client sdk.
My advise is you can use admin sdk on API (server-side) and feel free to use client sdk on your clients.
Use as managements on API, listening data, realtime chat etc. via client sdk.
You can check admin and client sdk. Also npm packages for React Native here.
Mixing will be of help, you can try:
Listen for small amounts of data using the client SDK
Write and sort data using the cloud functions
In my experience, writing to a firebase database that uses ordered ids (in my case) leads to some huge problems in the long run. I lost a good chunk of data when my app accidentally wrote to a root index instead of a child index when the app was resumed from inactivity because the android system cleared the RAM.
Also, for notification, use Firebase Cloud Messaging.

Is it possible to change Firebase Analytics User Properties from a backend?

Overview: I would like to send targeted push notifications in my Native Mobile App by using the segmentation offered by Firebase. The way I would like to configure this segmentation is by leveraging on custom Firebase Analytics User Properties, like specific preferences or other business specific parameters.
I've seen that is possible to update User Properties by means of the Firebase SDK and through them I will update a "custom ID" user property which helps me identifying my users; on the other side I would like to update other user parameters, which should help me segmenting users, through a backend process.
The Problem: is that I've not found how to update User Properties from a backend side, like through APIs or something like that.
Have someone figured out to implement this scenario?
Thanks
There is no server-side or REST API for Google Analytics for Firebase at the moment.
The two options that I know of:
Send the properties from your server to the client, and use the Firebase SDK on the client to get those properties in to Analytics.
Hook your Firebase analytics up to BigQuery, store the additional information from your server into BigQuery too, and then join then in your own analysis.

AngularFIre Firebase saving data locally?

I have an app that displays a list of items. Here is what I am doing.
When the app first loads I am making an HTTP request to get the list from the firebase database.
once the list is received the list is stored locally on localStorage for future use.
On future app loads, the list is loaded from localStorage to prevent unnecessary http calls
I am doing the above programmatically, i.e, saving data to localStorage and check for new data and getting it etc.
Does firebase provide any other way to the same?
There is no built-in support for cross page-reload persistence in the JavaScript SDK for the Firebase Realtime Database. Somebody is working on such functionality in the open-source repository, but no release was made with it yet.
If you need this functionality, I highly recommend looking into using Cloud Firestore. In addition to many other benefits, it supports cross page-reload persistence.

Cloud Firestore 'Oops, collections failed to load!'

Trying to play around with the new Cloud Firestore but when I choose the firestore dropdown the datapanel says: 'Oops, collections failed to load!'
Is this attempting to import my existing realtimeDB into and failing or some other reason?
Thanks,
Ben
It's not.
You might see this error if the Cloud Firestore API is not enabled: Check on the Cloud Firestore API page after selecting your project name.
You might also see this if App Engine is disabled, since we rely upon some common infrastructure: Check on the App Engine Settings page to ensure it's not disabled after for your project.
Currently I'm seeing the same error on my Firefox browser but it's working well on Chrome!
I got the same issue and I solved it by cloud firestore API page and select a project. Then click enable the firestore API.

Resources