Follow the below steps to enable sending push notifications to your users
Android Push Notifications
Android 13 and above
Starting from Android 13 and above, you need to ask users explicitly for their consent to receive push notifications.
Add this permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Android 12 or below
If the device uses Android 12 or below, permission to send notifications is already granted. You must ask the user for permission if the device uses Android 13 or above.
Enable user consent for push notifications
Use the following code based on the user's permission to allow/deny push notifications:
import {ContloAPI} from "react-native-contlo"
.
.
.
//If the user grants permission, call this function
ContloAPI.callback.onPushConcentChangedCallback(true)
//If the user denies or revokes the permission, call this function
ContloAPI.callback.onPushConcentChangedCallback(false)
Based on the consent received, the function will subscribe or unsubscribe your audience from Mobile Push on your Contlo dashboard.
iOS Push Notifications
Coming soon
Setting up Mobile Push Credentials
Go to Project Settings and click on the Service Account tab in your Firebase project. You will see a screen like this:
Clicking on Generate New Private Key will give you a JSON file with Firebase admin SDK credentials. If you have already generated one, use it for the next steps; otherwise, generate a new one.
Push settings on Contlo Dashboard
Then, in your Contlo Dashboard, go to settings and click on the Mobile Push tab. You will see a screen like this:
Set the credentials according to your JSON file and save.