From 617ea4a5ea17164dedd4ca5e5c6fce8d09dbb953 Mon Sep 17 00:00:00 2001 From: Daniil Date: Mon, 8 Apr 2024 10:34:20 +0300 Subject: [PATCH 1/9] chore: add instructions for android --- docs/firebase.md | 116 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 29 deletions(-) diff --git a/docs/firebase.md b/docs/firebase.md index 3914b031..d46c025e 100644 --- a/docs/firebase.md +++ b/docs/firebase.md @@ -6,36 +6,95 @@ To use Firebase in your project, you need to do the following: 1. If you haven't already, install [Firebase CLI](https://firebase.google.com/docs/cli). 2. Log in to Firebase CLI with your Google account: + ```sh firebase login ``` -3. If you haven't already, activate the FlutterFire CLI plugin: - ```sh - dart pub global activate flutterfire_cli - ``` -4. Create project at [Firebase Console](https://console.firebase.google.com/). -5. Execute command to create a new project for certain flavor (e.g. dev flavor) in Firebase or select existing and specify supported platforms: - ```sh - flutterfire configure \ - -p name_or_id_of_your_project \ - -o lib/config/firebase/firebase_options_dev.dart \ - --platforms android,ios \ - -i your.ios.bundleId.dev \ - -a your.android.package.name.dev - ``` - - params description: - - `-p` - name or id of your Firebase project; - - `-o` - path to file where Firebase options will be generated; - - `--platforms` - platforms for which Firebase options will be generated; - - `-i` - iOS bundle identifier; - - `-a` - Android package name. - - As a result, you will get `firebase_options_dev.dart` file with Firebase options for dev flavor and created apps in Firebase project. - -6. Move generated `ios/firebase_app_id_file.json` to `ios/Firebase/{flavor_name}` folder - e.g. `ios/Firebase/dev/firebase_app_id_file.json`. -7. Move generated `ios/Runner/GoogleService-Info.plist` to `ios/Firebase/{flavor_name}` folder - e.g. `ios/Firebase/dev/GoogleService-Info.plist`. -8. Pass generated `DefaultFirebaseOptions` to `Environment` in entry point of your app: + +3. Create project at [Firebase Console](https://console.firebase.google.com/). + +4. Configure app for desired platform. + +### Android + +[Actual offical guide.](https://firebase.google.com/docs/android/setup) + +#### Add Firebase using the Firebase console + +- Create a Firebase project. + +- In the [Firebase console](https://console.firebase.google.com), click Add project. To add Firebase resources to an existing Google Cloud project, enter its project name or select it from the dropdown menu. To create a new project, enter the desired project name. You can also optionally edit the project ID displayed below the project name. + +- If prompted, review and accept the [Firebase terms](https://firebase.google.com/terms). + +- Click Continue. + +- (Optional) Set up Google Analytics for your project, which enables you to have an optimal experience using any of the Firebase products. Either select an existing [Google Analytics account](https://support.google.com/analytics/answer/1009618?ref_topic=3544906&authuser=0#zippy=%2Cin-this-article) or to create a new account. If you create a new account, select your [Analytics reporting location](https://firebase.google.com/docs/projects/locations), then accept the data sharing settings and Google Analytics terms for your project. You can always set up Google Analytics later in the [Integrations](https://console.firebase.google.com/project/_/settings/integrations) tab of your settings Project settings. + +- Click Create project (or Add Firebase, if you're using an existing Google Cloud project). + +- In the center of the project overview page, click the Android icon (plat_android) or Add app to launch the setup workflow. + +- Enter your app's package name in the Android package name field. The current package name can be found in your module (app-level) Gradle file, usually android/app/build.gradle, defaultConfig section (example package name: com.yourcompany.yourproject). + +- (Optional) Enter other app information: App nickname and Debug signing certificate SHA-1. + +- Click Register app. + +- Download and then add the Firebase Android configuration file (google-services.json) to your app. Click Download google-services.json to obtain your Firebase Android config file. Move your config file into the module (app-level) root directory of your app. + +- In your root-level (project-level) Gradle file (```/build.gradle```), add the Google services plugin as a dependency: + +```gradle +plugins { + id 'com.android.application' version '7.3.0' apply false + // ... + + // Add the dependency for the Google services Gradle plugin + id 'com.google.gms.google-services' version '4.4.1' apply false +} +``` + +- In your module (app-level) Gradle file (```//build.gradle```), add the Google services plugin: + +```gradle +plugins { + id 'com.android.application' + + // Add the Google services Gradle plugin + id 'com.google.gms.google-services' + // ... +} +``` + +- In your module (app-level) Gradle file (```//build.gradle```), add the dependencies for the Firebase products that you want to use in your app. We recommend using the Firebase Android BoM to control library versioning. + +```gradle +dependencies { + // ... + + // Import the Firebase BoM + implementation(platform("com.google.firebase:firebase-bom:32.8.0")) + + // When using the BoM, you don't specify versions in Firebase library dependencies + + // Add the dependency for the Firebase SDK for Google Analytics + implementation("com.google.firebase:firebase-analytics") + + // TODO: Add the dependencies for any other Firebase products you want to use + // See https://firebase.google.com/docs/android/setup#available-libraries + // For example, add the dependencies for Firebase Authentication and Cloud Firestore + implementation("com.google.firebase:firebase-auth") + implementation("com.google.firebase:firebase-firestore") +} +``` + +### [iOS](https://firebase.google.com/docs/ios/setup) + +### [Web](https://firebase.google.com/docs/web/setup) + +5. Pass generated `DefaultFirebaseOptions` to `Environment` in entry point of your app: + ```dart /// Main entry point of app. void main() { @@ -59,10 +118,9 @@ To use Firebase in your project, you need to do the following: To set up uploading dsym to firebase on iOS, you need to follow steps 6 and 7 from the instructions above for each flavor. To download dsym to Android you need to call the command + ```sh firebase crashlytics:symbols:upload --app=FIREBASE_APP_ID PATH/TO/symbols ``` More details are described in [this guide](https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=flutter) outlines what the automation does and provides first steps to debug your project setup. - - From 1d7f380a4bb6facad2e72cdd4fc3c9f51a87b6d9 Mon Sep 17 00:00:00 2001 From: Daniil Date: Mon, 8 Apr 2024 10:41:55 +0300 Subject: [PATCH 2/9] chore: add web instructions --- docs/firebase.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/firebase.md b/docs/firebase.md index d46c025e..4717c2b6 100644 --- a/docs/firebase.md +++ b/docs/firebase.md @@ -13,16 +13,6 @@ To use Firebase in your project, you need to do the following: 3. Create project at [Firebase Console](https://console.firebase.google.com/). -4. Configure app for desired platform. - -### Android - -[Actual offical guide.](https://firebase.google.com/docs/android/setup) - -#### Add Firebase using the Firebase console - -- Create a Firebase project. - - In the [Firebase console](https://console.firebase.google.com), click Add project. To add Firebase resources to an existing Google Cloud project, enter its project name or select it from the dropdown menu. To create a new project, enter the desired project name. You can also optionally edit the project ID displayed below the project name. - If prompted, review and accept the [Firebase terms](https://firebase.google.com/terms). @@ -33,6 +23,12 @@ To use Firebase in your project, you need to do the following: - Click Create project (or Add Firebase, if you're using an existing Google Cloud project). +4. Configure app for desired platform. + +### Android + +[Actual offical guide.](https://firebase.google.com/docs/android/setup) + - In the center of the project overview page, click the Android icon (plat_android) or Add app to launch the setup workflow. - Enter your app's package name in the Android package name field. The current package name can be found in your module (app-level) Gradle file, usually android/app/build.gradle, defaultConfig section (example package name: com.yourcompany.yourproject). @@ -93,6 +89,14 @@ dependencies { ### [Web](https://firebase.google.com/docs/web/setup) +- In the center of the project overview page, click the Web icon (web_android) or Add app to launch the setup workflow. + +- Enter your app's name in the app nickname field. + +- Select 'Use a ```