Firebase Configuration
Setting up Firebase for your Closer Dating App Project
Create A New Firebase Project
Step 1
Follow the link to create firebase project Firebase:
Setp 2
After completing the project, you will be presented with this type of
dashboard.
Setp 3
Go to the Project Settings and configure the Support Email.
Add App With The Package Name In Firebase Console
Step 1
On the Firebase console, click the Android / IOS icon.
Setp 2
Enter Package Name (e.g., com.example.userApp) and click on register app.
Setp 3
After registering the app, you will receive the Google JSON file, download it and save it to the Navigate to android/app/
folder.
For IOS
You should open Navigate to ios/Runner.xcworkspace
with xcode then Place your google-json file as shown in pic below
Set Up Firebase Authentication
Step 1
Go to Build -> Authentication tab and click on Get started.
Setp 2
Then select the Email/Password, Google, Apple, and Phone Number one by one and enable them.
Setp 3
Re-check if all these 3 modes of authentication are enabled or not.
Activating The Firestore Database
Step 1
Go to Build → Firestore Database tab and click on Get Started.
Setp 2
When you click the Get Started button, a dialogue will appear asking you to choose a mode. Because we are testing, we will select the Start in Test Mode option and then click Next and then enable it.
Setp 3
Change the Firestore's rules to save the data in a database.
SHA Fingerprint
Note info SHA-1 fingerprint is a unique key generated for your PC that can be used for signing. It is important to have in the add Firebase as we are using Google Login and OTP Login, and to authorize these logins, we need a SHA Fingerprint certificate
Add a SHA fingerprint to Firebase:
Step 1
Follow these steps if you didn't initially provide a SHA certificate fingerprint for your Firebase Android app or if you need to add an additional one:
In your Project settings, go to the Your apps card.
Setp 2
Select the Firebase Android app to which you want to add a SHA fingerprint.
Setp 3
Click Add fingerprint.
Setp 4
Enter or paste the SHA fingerprint, then click Save.
Read below to generate SHA key then add here.👇
Generate a new JKS/Keystore
Run the following command in your terminal
keytool -genkey -v -keystore android/<JKS FILE NAME>.jks -alias <ALIAS NAME> -keyalg RSA -keysize 2048 -validity 10000
exmple command
keytool -genkey -v -keystore android/example.jks -alias example -keyalg RSA -keysize 2048 -validity 10000
Here
- JKS File Name: example
- Alias Name: example
The command will generate a JKS file in your android directory. The validity of the keystore certificate is set to 10,000 days. If you don't add -validity <NumberOfDays>
, the default value will be 90 days.
Note: If you encounter an error like Command keytool not found
, you'll also receive a suggestion to install keytool. Follow the suggestion and execute the command to install keytool
.
Generate the SHA from Android Studio
Step 1
Create a file in android folder of your project name key.properties if not exists.
storePassword=<Your JKS password>
keyPassword=<Your JKS Key Password>
keyAlias=<You JKS Key Alias>
storeFile=<Your jks file location path>
Setp 2
Add following line to your Android/app/build.gradle file above the all android block (Check if this line already exist or not)
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists())
{
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Setp 3
Now in app:build.gradle android block check for below lines if not exist Add into your Android/app/build.gradle
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Setp 4
Open your terminal and enter following command
cd android
./gradlew signinReport
Wait for a while, and it will generate your SHA. Copy both SHA1 and SHA256 for both Debug and Release variants & configurations. Then, add these keys to your Firebase project. You may redownload goodle json file to make sure up to date with latest file.