Configure FCM credentials so your Rails server can send push notifications to Android devices. If you haven't yet, set up the Rails side first.
Android delivery runs through Firebase Cloud Messaging (FCM). The action_push_native device model stores Android tokens with platform: "google".
Unlike iOS, Android push needs a Firebase project. The app reads it from your config, so this is a one-time step and never needs a new build.
google-services.json file. Firebase then prompts you to add the SDK and verify the install. Skip those steps.config/ruby_native.yml and deploy your site.# config/ruby_native.yml
android:
firebase:
app_id: "1:1234567890:android:abc123" # client > client_info > mobilesdk_app_id
api_key: "AIza..." # client > api_key > current_key
project_id: "your-project" # project_info > project_id
sender_id: "1234567890" # project_info > project_number
None of these are secrets. They ship inside every Android app that uses Firebase. If the file lists more than one client, use the one whose package_name matches your app. If your config already has an android: block for App Links, put firebase: inside it.
That covers the app's half: the project it registers with so it can receive notifications. validate_config tells you if a value is missing.
If you uploaded google-services.json to the dashboard before this moved to your config, your builds still carry that file and push keeps working. Add the four values to your config when it's convenient; the Push tab shows them filled in from your file.
To send notifications, your server needs a service account key from the same Firebase project.
This JSON is a credential. Treat it like a password and do not commit it to your repo.
On a Google Cloud organization (common with Google Workspace accounts) the download can fail with:
Key creation is not allowed on this service account. Please check if service account key creation is restricted by organization policies.
Your organization enforces a policy that disables service account keys, and you need an organization admin to lift it:
iam.disableServiceAccountKeyCreation), and set it to not enforced for the organization.The contents of that JSON file go into your Rails credentials. Run bin/rails credentials:edit and add the fcm section:
action_push_native:
fcm:
project_id: your-firebase-project-id
encryption_key: |
{
"type": "service_account",
"project_id": "your-firebase-project-id",
"private_key_id": "...",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "...",
...
}
Paste the JSON exactly as Firebase generated it. Keep the inner private_key value untouched, including its \n escapes. Every line must be indented deeper than encryption_key: so YAML reads it as one block.
The installer creates config/push.yml. Add a google section so the gem can send through FCM:
# config/push.yml
shared:
google:
project_id: <%= Rails.application.credentials.dig(:action_push_native, :fcm, :project_id) %>
encryption_key: <%= Rails.application.credentials.dig(:action_push_native, :fcm, :encryption_key)&.dump %>
If your app also supports iOS, this sits alongside the existing apple section. The gem picks the right service per device automatically.