How to consume Google map web services API in my flutter APP - google-maps-api-3

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.

Related

how to get Firebase Analytics App Instance Id for Web App?

I am trying to log purchase event via Google Analytics 4 Measurement Protocol. if I read this documentation, it is said that I must have app_instance_id so I can send the data from our backend to GA4 server.
we are using Vue and Firebase Nuxt for our web app, but unfortunately, as you can see from the image below, I can't find a method to get app_instance_id
so how to get app_instance_id for web app in Firebase for web app? is it not available yet? please help
unfortunately, for now the app_instance_id is not available for web. please read the full explanation in Github from Firebase Analytics repo maintainer in here

How to restrict Google API Key for Hybrid app?

I'm building a production hybrid mobile app that uses Firebase/Firestore. Since it's a hybrid app, I can not use the bundle ID or HTTP referrer methods to restrict the API key (Google support confirmed this is not supported).
My worry is that anyone could decompile the app and get the API key, using it with a simple Node.js script locally, and access my database.
Node.js scripts can bypass all Firestore rules, making unrestricted API keys very powerful. So far I have been unable to find a way to restrict keys with hybrid apps, including reaching out to Google support. I'm wondering if the only way to actually achieve firebase/firestore security is to use Native apps vs. Hybrid?
Actually for ios, we are not able to restrict the google api key. But, for android we have done with HTTP referrer method only.
For android it is possible.
If you are using ionic4, Please use the same origin value whatever you set in you config.xml corresponding to you android app.

Enabling Crashlytics with Firebase Management API

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.

FCM Security Alert

Security alert
Your app contains exposed Google Cloud Platform (GCP) API keys. Please see this Google Help Center article for details.
I have an android application uploaded in google play store which uses Firebase for App Cloud Messaging in android. I have recently got an alert from play console that
Security alert : Your app contains exposed Google Cloud Platform (GCP) API keys. Please see this Google Help Center article for details.
Could you please tell anyone to resolve this issue.
Thanks in advance.
Hi this warning would come because the google cloud platform api key you are using in your app might be exposed you have to put the restriction on this api key from Google Cloud Console.
There are two type of restriction
1. Application Restriction
2. API Restriction
Please refer below link
https://cloud.google.com/docs/authentication/api-keys#api_key_restrictions

Firebase Analytics to Google Analytics, how to retrieve the Client ID?

we are planning to move from the GA SDK to the Firebase SDK. Within the GA SDK there were options to retrieve the google analytics client ID (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cid). This was fundamental since we transferred this value to the WebView (within the app), so that the customers tracking across native/webview was possible.
Does anybody know how to retrieve this client ID within firebase analytics SDK (iOS & Android)?
Thanks!
The short answer is no - the client ID equivalent (app instance ID) is not currently accessible through an SDK API.
The longer answer :
Firebase Analytics currently only supports logging events from native code. And so, the js code in your webview would call native code to log events and you don't need access to the app instance ID.

Resources