Android FCM push notifications
FCM push notifications setup
Setting up Firebase Cloud Messaging (FCM) can be complex. Unless you specifically need it, consider using notifications through the WebSocket instead for development.
If you want your own FCM setup for push notifications, follow these steps:
-
Create a Firebase project
Go to the Firebase Console and create a new Firebase project. -
Add Android apps to the Firebase project
Add the following package names as Android apps in your Firebase project:io.homeassistant.companion.android
io.homeassistant.companion.android.debug
io.homeassistant.companion.android.minimal
io.homeassistant.companion.android.minimal.debug
-
Deploy the push notification service
Visit the mobile-apps-fcm-push repository and deploy the service to your Firebase project. -
Set the push notification URL
Once you have theandroidV1
URL for the deployed service, add it to your${GRADLE_USER_HOME}/gradle.properties
file. For example:homeAssistantAndroidPushUrl=https://mydomain.cloudfunctions.net/androidV1
Optionally, you can also define the rate limit function URL:
homeAssistantAndroidRateLimitUrl=https://mydomain.cloudfunctions.net/checkRateLimits
-
Download and place the
google-services.json
File
Download thegoogle-services.json
file from your Firebase project and place it in the following folders:/app
/automotive
/wear
The google-services.json
file must include client IDs for all the package names listed above. Without this, FCM push notifications will not work (only WebSocket notifications will function).