Firebase
Setup
Let's configure Firebase for cloud messaging
Navigate to https://firebase.google.com/ and sign to your existing account or sign up
Create a new project and give it a name (e.g. ChatAI)
- Press on continue
- Select a google analytics account and press on Create project
- We have to add both Android and iOS Apps. Let's start by adding the Android App. Press On the Android icon.
- Type the package name and press on Register App.
- Press on Download google-services.json and save it somewhere on your pc. Then press next till the end.
Go back to the project overview and press on the Apple icon.
Type the apple bundle Id and press on Register App
- Press on Download GoogleService-Info.plist and save it somewhere on your pc. Then press next till the end.
- Go to your project files and add the previously downloaded json and plist files in steps 6 and 9 to the root project folder.s
Realtime Database
Go back to firebase, then to the project overview and download this json files Download
Press on the Realtime Database and import the JSON file previously downloaded. This will import the necessary configuration of the app.
After successfully importing the configuration, let's explore the various configurable aspects of the application (In the next 3 images):
- Configuration:
- Ads: In this section, you should input your Ad IDs, which you will generate in the next step.
- Examples: This is where you can customize the content of the application's homepage, including text in three different languages.
- Links: Here, you need to provide the links to your privacy policy and terms & conditions, which will be displayed within the app.
- Product IDs: This section is where you should enter the subscription IDs after creating them in Apple Store Connect and Google Play Console.
- Other: In this category, you should input the Apple App ID and Google Package Name to enable the App rating feature. Additionally, you can set the daily free message limit, which is initially set to 5 messages.
- Users: In this section, you can view all of the application's users and adjust their daily message limits. Please be cautious when removing a user from this list, as it may result in unintended behavior within the app.
This revision aims to make each section's purpose clearer and easier to understand.
- Lastly, we have to update the database rules to be able to read and write to the database, copy the rules below and paste them as shown in the image below.
{
"rules": {
"configuration": {
".read": "true",
".write": "false"
},
"users": {
"$uid": {
".read": "true",
".write": "true"
}
}
}
}