Enabling Crashlytics with Firebase Management API - firebase

We are developing large number of customized Android and iOS applications for our customers. We have used Fabric to manage the crashes and Google Cloud Messaging to send push messages for the applications. We have now migrated all those applications to Google Firebase.
We are using Firebase Management REST API to create the applications into Firebase enabled projects from our PHP backend. For Android apps we use methods projects.androidApps.create and projects.androidApps.getConfig to get access to the application google-services.json. We include that to the build, which passes without errors and the push messages work without a problem. However, the Crashlytics side does not get enabled. In Firebase console there is only a wizard to set up a new Firebase app. When running it, it gives impression that Craslytics will get enabled, when the app starts using Firebase, but it is not.
Is there an API to enable the Crashlytics for an app? We can use REST or PHP based API in the backend. Also, if there is a client side API to awaken Crashlytics, we can use that too.

This is currently not possible, though with the new Crashlytics SDKs we are looking at ways of changing this behavior. In the future, as soon as we receive a crash event we will enable the Crashlytics dashboard. The timeline for this though, is unknown.

Related

Firebase API Key Application Restriction Problem

I received an alarming email from Google a couple of days ago stating that:
[Action Required] Firebase services for your application are malfunctioning due to Application restrictions
I have a Vue based website that uses Firebase for Authorization of users and storing files they are uploading. When I configured the API key that I set up, I restricted this key on the application level, to only work from the address of my website.
I did not impose any API restrictions - Under API Restrictions the radio button with Don't Restrict Key is marked
Having said that, when I try to use my website, I get the following error:
[403] Requests from referer [WEBSITE] are blocked.
The email I got from Google stated that:
Firebase SDK updates on February 27, 2020 (Android) and January 14, 2020 (iOS) replaced the Firebase Instance ID service with a dependency on the Firebase Installations API.
As a result, Firebase services like Firebase Cloud Messaging will malfunction for users who installed your app after it was released with updated Firebase SDKs. Additionally, repeated failing requests to Firebase may slow down the end-user experience of your app.
Application restrictions you have applied to the API key used by your Firebase application need to be updated to allow your application to use the API key.
Inside this mail, there were the following instructions:
Open the Google Cloud Platform Console.
Choose the project you use for your application(s). Open APIs &
Services and select Credentials.
Click Edit API key for the API key in question.
Scroll down to the Application restrictions section.
Change the radio button to None, and click Save, or add your
application to the list of allowed Android apps, iOS apps, or HTTP
referrers, respectively.
If the radio button already shows None you may be looking at the
wrong API key.
You can check which API key is used for the Firebase Installations
API by looking at the service usage page for your project.
Since I do not have any API restrictions and there is also no other API key that I have, I don't understand how to solve this situation.
One option that works is having no application restrictions, but I don't think that is the correct solution.
I also tried changing the API Restrictions to allow only the services from Firebase that I am using, but that did not fix the problem.
Any help or direction to a solution, will be appreciated.

Firebase Phone Auth is not working in flutter app neither in iOS simulator nor in a real device

I have been trying and searching various methods to make Firebase Phone Auth to work in my flutter application. (There is an open issue talking about conflicts between Firebase Cloud Messaging & Firebase Phone Auth, but I am unsure if my issue is related to that. I do use Firebase Cloud Messaging which works perfectly fine.).
In iOS simulator, whenever I call FirebaseAuth.instance.verifyPhoneNumber, my app opens a web page for reCAPTCHA workflow, and returns back to the app. Then I see the error logs like below in verificationFailed callback. (It is expected to follow reCAPTCHA flow for iOS Simulator according to Firebase Phone Auth Doc)
flutter: Instance of 'AuthException'
flutter: {"error":{"code":403,"message":"Requests from this ios client application <empty> are blocked.","errors":[{"message":"Requests from this ios client application <empty> are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}
It is suspicious that error message is using <empty> as my application name, instead of my real app name (or default firebase app name which is __FIRAPP_DEFAULT), but I am unsure why that is happening.
In real iOS device, whenever I call FirebaseAuth.instance.verifyPhoneNumber, the app invokes verificationFailed callback again and I get the error with verifyPhoneNumberError as code and Token mismatch as error message. This is happening in both debug build as well as in release build.
I am using following SDK & library versions.
Flutter SDK = 1.12.13+hotfix.5
firebase_core = 0.4.3
firebase_auth = 0.15.4
firebase_messaging = 6.0.9
Has anyone been able to get Firebase Auth Phone auth working in iOS? I am stuck in this limbo state because I cannot seem to search any info online related to this. I have setup iOS APN, GoogleService-info.plist, Google Cloud Credentials multiple times so far with no luck. (Given that Firebase Cloud Messaging works perfectly fine, I doubt it is an issue with credentials or APN setup.)
Answering my own question since I figured out the root cause.
In Google Cloud Project that is connected to Firebase, I was able to find a set of API Keys that were created by Firebase.
https://console.cloud.google.com/apis/credentials
For each App you define and create in Firebase, a new API key will be auto-created in the API key section. In my case, there was one for 'iOS key (auto created by Firebase)' and another for 'Android key (auto created by Firebase)'.
Well, by default, they do not impose any restrictions and you see a yellow triangle next to the key. So I added restrictions to those keys so that they can only be useable in my app. This is done by setting Application restrictions with corresponding bundle id for iOS and another app id for Android within each API key detail page.
This restriction was actually the reason that Phone Auth has not been working in my apps. Once I reverted the change back to None, I no longer encountered Token mismatch or AuthException.
Ideally, I should restrict these API keys to my app only, but it seems like my Flutter app is unable to prove its identity/appId/bundleId to google services, and Google had been rejecting requests from my App. This must be why I was seeing Requests from this ios client application <empty> are blocked. error message.
For now, everything is working because there is no restriction, but I will need to figure out why my app and its id association is not working as expected sooner than later, so that I can add restriction back.

How to consume Google map web services API in my flutter APP

I am new in Flutter, and I have pretty good knowledge of using Google maps APIs for native Android Apps. However, in my flutter app, I need Google Places search Auto-complete. I came across a plugin called google_maps_webservice where it consumes google maps APIs such as directions, places and geocoding using Google web services. My question is having low understanding and experiences in setting up web services for google maps API, how I can use the plugin in my flutter app? For example, if I had to use places API in android I would have enabled Goole Places SDK in cloud console and generate an API restricting for Android App. But for a flutter, both Android and iOS are going to use the same services from a web API call. what should I do? And right now I have no backend knowledge to set up a domain to use while creating the API from the console.
You can import the google_maps_webservices package
import 'package:google_maps_webservice/places.dart';
and use it in your code:
final places = GoogleMapsPlaces('<Your-API-Key>');
final response = await places.autocomplete('<What-you-are-searching-for>');
if (response.isOkay) {
for (Prediction prediction in response.predictions) {
print(prediction.description);
}
}
Some caveats:
1. Ensure that you are using the Web API key
2. Ensure to activate the Google Places SDK in Cloud Console.
3. To avoid getting an OVER_QUERY_LIMIT status message, ensure that you are using a billing account.

GCM to FCM migration ionic v1

I have an ionic v1 app. I've read and re-read the information about GCM to FCM migration, but I am still not 100% certain that my (unmigrated) app will still receive push notifications after April 11. I have migrated the server to FCM. I believe that the app should still work, but need it verified for certain.
Based from this link, you need to update your client code and migrate to FCM.
Existing deployed client-side apps receiving notifications will continue to work for the foreseeable future. But from mid-april, you:
won't be able to compile code using the old client-side APIs on a newer SDK/Google Play Services anymore
won't be able to call the GCM REST API to send messages anymore
To compile against the new SDK/Google Play Services, you will need to make changes to your client app to migrate to Firebase Cloud Messaging from GCM. This involves changes to the build.gradle, to AndroidManifest.xml and to your code, as described in Migrate a GCM Client App for Android to Firebase Cloud Messaging.
But aside from those changes, you don't need to get new tokens for all users. The existing tokens from GCM will continue to work.

how to enable Firebase Cloud Messaging in an apk published in the play store

I have developed an application using android studio. It is already published in the google play store.
This application uses the Firebase FCM service for push notifications.
During the development stage, this worked perfectly. But since the publication in the play store, the SendMessageNotification function is not executed in the firebase backend (Firebase functions).
I have entered the api key in the console, as shown:
.
However, the service continues without running.
Have I skipped a step?
Have you gone through the firebase launch checklist?
Specifically, have you remembered to add the production certificate for your app as well as the development certificate? From the above page "Add a release SHA1 fingerprint for Android apps in the Firebase console (for OAuth client IDs)."
I don't know if this affects client messaging or not.

Resources