Does Firebase Real-Time DB now explicitly require Google Play Services? [duplicate] - firebase

This question already has answers here:
Which firebase services require google play services on Android?
(4 answers)
Closed 4 years ago.
Background
I have an older app that still runs properly and is based on an old version of Firebase using the Real-time database functionality.
It runs on my emulator that does not have Google Services available.
Attempting To Upgrade To New Firebase
Now, I'm attempting to upgrade that code and I'm running on an emulator image that does not have Google Play services available.
Installed Firebase Via Android Studio Tools...Firebase...
I did the installation via the built-in tools from Android Studio (following the latest docs from Firebase).
The Problem
Every time the new code based on the latest version of Firebase attempts to call the following line of code I get an error (follows):
FirebaseDatabase fbd = FirebaseDatabase.getInstance();
Error Message
I get the following error:
Default FirebaseApp is not initialized in this process . Make
sure to call FirebaseApp.initializeApp(Context) first.
I'm Already Making That Call
However, I am successfully making the call to FirebaseApp.initializeApp(Context) previous to that line of code -- I've stepped thru via debugger.
Unsure About Google Services
I've seen that some say you have to add a reference to the Google Services but I'm not sure why the Firebase docs don't mention that and the built-in Android Studio tool didn't add it.
Can you point me to a definitive place in the docs where it says you need Google Services? Has anyone experienced this? Does anyone know for sure if Google Services are required?

Ok, I looked more closely at the Firebase docs (https://firebase.google.com/docs/reference/android/com/google/firebase/database/FirebaseDatabase.html#getInstance(java.lang.String))
Here's a snapshot of the info:
I'm adding that because of that odd Also: Google Play Services item. It's a link that does nothing. It isn't very helpful, but
I'm assuming it means that you do indeed need Google Play Services to be available.
This situation is odd for another reason also, and that is because the call to FirebaseApp.initializeApp(this); succeeds without error even though you can basically do nothing after that, since you will have a dependency upon Google Services for the core functionality.

Related

Amplify API Reference

I am having a really difficult time navigating the API reference. The old AWS SDK for java used to have all used classes labeled with their proper parameters, errors thrown, and return values. I am not finding this with Amplify.
Currently I am trying to understand the Amplify.storage class for Android. The closest reference I can find for it is here,
https://aws-amplify.github.io/amplify-js/api/classes/storage.html
The problem is that it does not describe the function used by their tutorial, Amplify.Storage.downloadFile()
This all seems to be the javascript implementation of this and not the java based SDK so maybe that is the problem. I've been digging around on google and I can't find anything useful, is there reference material out there that I am just not finding or is this what we have to work with?
As I dig I keep getting linked back to the tutorial which is very frustrating because I want more information than what the tutorial provides.
The Amplify Android project does not currently publish its Javadoc.
I have created an issue for this on the Amplify Android GitHub repo.
For the time-being, your best bet is to read the source code, which does contain JavaDoc. The API for the storage category is here.

Can I use Firebase Analytic Web SDK for a Cordova App?

I'm developing a cross platform app: Web, PWA, iOS (Cordova) & Android (Cordova).
I use the same code base, and Firestore & Auth are working well on all the platforms using only the Web SDK.
However, when I add the Firebase Analytic plugin, it works as expected on the Web / PWA, but the iOS / Android apps do not seem to send back anything.
Is there a way to make Analytic works using only the Web SDK? Or is it mandatory to use a Cordova Plugin?
Thank you in advance for your help.
Note: I'm using Framework7 & VueJS
Edit 1
It seems that cordova is officially supported for analytic with the web SDK.
So the question becomes: do you have any idea why the implementation is working for "normal" app and break when on cordova?
https://firebase.google.com/support/guides/environments_js-sdk#other_environments
Edit 2
Now that I know that it should work, I'm trying harder to find solutions.
First, I observed in the Safari Console that on y web app, I can observe calls to https://www.google-analytics.com/g/collect every time I'm logging an event.
I do not observe those calls on the Cordova app, which is most probably the reason why I do not receive anything in my Firebase Analytics.
The question becomes: why are those call not made in cordova, considering the js the same?
Edit 3
Ok, I think I found the explanation:
Google Analytics from a file:// url
The question becomes: since Analytic is loaded automatically with firebase, how can I make this configuration?
Ideally, I would like a way to set the client id using a hash of my user uuid (as I said in my post, I'm using Firebase Auth).
How can I dynamically change the value each time a user connect to the app? Can Firebase directly take care of this?

Firebase Crashlytics: Same app sending to different firebase projetcs [duplicate]

I am building an android library that I plan to integrate into many 3rd party apps(which do not belong to me).
So, I am trying to figure out a way to find out if any of those 3rd party apps crashes due to the code in my library. Is there any way to find that out?
I was looking at Crashlytics to achieve the same. But, as I understand, Crashlytics will be able to give the Crash analytics to only the app owner, right? Is there any way to collect the crash info without the intervention of the 3rd party app?
Thanks.
EDIT: This isn't a duplicate of Integrating Crashlytics to library project because I want Crashlytics to be part of an android library which will sit on multiple android apps, but I want to be notified separately - not from the app which is installing my android library.
Mike from Fabric here. Adding Fabric or Crashlytics into a library that will be used by external developers is not supported and should not be done.
No, you cannot, at least without some hacking. Crashlytics should only be user in applications or library subproject (https://docs.fabric.io/android/crashlytics/build-tools.html#set-up-a-library-subproject). And you shouldn't, crashlytics group all the crashes by package name. Even if you with some hacking were able to include the crashlytics in your library you will probably receive also crashes from the application (not related with your library), and you will need to include and expose your API keys in your library... So you should not include crashlytics in a library.

Issues in migrating Google Cloud Project to Firebase

I have projects available in google cloud which i want to import on firebase. On firebase console, none of the project got listed in dropdown of adding project. On further investigation, I got to know that a google's below API is getting crashed.
https://mobilesdk-pa.clients6.google.com/v1/projects:listMigratable?key=
Status Code: 500
I have filed a ticket on firebase support as well. Meanwhile, can anyone have a workaround or any solution to help me in proceeding forward?

How do I listen for Firebase Cloud Messaging messages in the background in a Google Chrome Extension?

I have a Google Chrome Extension that listens for GCM messages in a background script via chrome.gcm.onMessage.addListener. Our provider is planning to upgrade their infrastructure to use the latest Firebase Cloud Messaging which is no longer compatible with GCM. We've confirmed the gcm addListener API no longer receives messages after upgrading to FCM in the dev environment.
I've found migration guides for Android, iOS, and progressive web apps but none specifically for background scripts in Chrome extensions.
Some resources I've found:
Official Chrome Extension example but is specifically for authentication
Documentation for JavaScript, specifically PWAs
Upgrade notification from the Google Developers Blog
The extension that I mentioned in my question three years ago still exists today and continues to rely on the chrome.gcm extension API.
Recently we noticed the gcm.notification.badge value is no longer being passed along with the data object, instead we're seeing a gcm.notification.e property that I believe contains the badge value. I was unable to find any documentation on why that property changed but I did find an answer to my original question:
We are deprecating the chrome.gcm API and encourage you to move to Web
Push Notifications using VAPID authentication. This works on the Web,
in Chrome Extensions and in Chrome Apps. You can find more information
here:
https://developers.google.com/web/fundamentals/push-notifications/
Web Push Notifications offer a slightly different set of features from
the chrome.gcm API. Please file an issue or contact us directly if you
believe that it cannot satisfy your requirements.
Source: https://bugs.chromium.org/p/chromium/issues/detail?id=831532

Resources