Firebase Integration
Create Flutter Firebase App
For creating a firebase app from flutter you must install firebase cli first.
To install firebase cli follow https://firebase.google.com/docs/cli
After firebase cli installation, follow these steps:
-
Create a firebase project:
- Enter your project name and press continue
- Press continue on the Google Analytics option
- Press "create project"
-
Create flutter app:
- Press "Flutter" option
- Press next
-
Go to Android Studio terminal and run "firebase login" command:
- Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Set "YES" and press enter
- Login to firebase from the browser when prompted
-
Run the first command shown in the Firebase console in Android Studio terminal
-
Run the second command shown in the Firebase console in Android Studio terminal:
- Once output is shown, press "Enter" in terminal
- When prompted again, press "y" in terminal
-
Press continue in the Firebase console
-
Press "continue to console"
Your firebase setup is now complete.
Enable Firebase Authentications
-
Open your firebase console
-
Go to Authentication and open Sign-in method
-
Enable Phone Sign-in method and save
-
Follow the same steps to enable other authentication options (Google, Apple) if needed
You also need to add SHA1 and SHA256 keys in Firebase:
For Debug SHA:
-
Go to the android folder, right-click gradlew file and select Open in Terminal
-
In the terminal, type
gradlew signingReport
(for Mac, use./gradlew signingReport
) -
Copy the debug SHA1 and SHA256 values that are printed, and add them to your Firebase console
For Release SHA:
-
After releasing to the Play Store, get the SHA from Play Console
-
Or generate it using this command in cmd:
keytool -list -v -keystore "YOUR_KEYSTORE_PATH.jks" -alias YOUR_ALIAS
For iOS:
-
Add custom URL schemes to your Xcode project:
- Open your project configuration: double-click the project name in the left tree view
- Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section
- Click the + button, and add a URL scheme for your reversed client ID
- Find this value in the GoogleService-Info.plist configuration file (REVERSED_CLIENT_ID key)
Firebase Setup For Admin Panel
-
Open firebase console (https://console.firebase.google.com/)
-
Select your created project
-
Go to Project settings
-
In the General tab, scroll down to "Your apps" section
-
Click on the web app icon (
</>
) to add a web app -
Enter your app name and click "Register app"
-
Copy the Firebase configuration code provided
-
Paste this configuration in your admin panel settings