Push notifications on Android
Set up your own Firebase project and push service, for when you work on notifications delivered through Firebase Cloud Messaging.
The full flavor receives notifications through Firebase Cloud Messaging (FCM). Home Assistant sends a notification to a push service of the project, which hands it to FCM, which delivers it to the phone. The mobile app API describes that contract.
You only need your own setup if you work on that path. For everything else, the mock Firebase file from get started is enough, and notifications still reach the app over the WebSocket connection. That is also how the minimal flavor gets its notifications.
Setting up FCM takes some effort. If you can test your change with WebSocket notifications, do that.
-
Create a project in the Firebase console.
-
Add an Android app to the project for each of these application IDs:
io.homeassistant.companion.androidio.homeassistant.companion.android.debugio.homeassistant.companion.android.minimalio.homeassistant.companion.android.minimal.debug
-
Create the default Cloud Firestore database in your Firebase project. The push service keeps its rate limits there, unless you configure it to use Valkey instead.
-
Deploy the push service from home-assistant/mobile-apps-fcm-push to your Firebase project.
-
Point the app at your service. Add the URL of the deployed
androidV1function togradle.propertiesin your Gradle user home (~/.gradle/gradle.properties), not the one in the repository:PropertieshomeAssistantAndroidPushUrl=https://push.example.com/androidV1Optionally, also point the rate limit check at your service:
PropertieshomeAssistantAndroidRateLimitUrl=https://push.example.com/checkRateLimitsWithout these overrides, the app uses the project's own push service, set in the
gradle.propertiesof the repository. -
Download
google-services.jsonfrom your Firebase project and put it inapp/,automotive/, andwear/.
The google-services.json file must contain clients for all four application IDs. If one is missing, FCM does not work for that build, and only WebSocket notifications arrive.