Skip to content

Commit de06535

Browse files
authored
Update FCM steps in README.md (#711)
Had some struggles setting up FCM in my repository with the given documentation, so I'm suggesting some extra steps people might look over on their initial tests. From the documentation it's not immediately clear that `data` is not where the title and body of a notification go. Leaving `notification` blank causes rpush to return a success, but nothing will actually arrive on the device. The project ID also might have changed labels overtime, as setting the "project ID" as my `firebase_project_id` instead of the "project number" also prevents notifications from showing up.
1 parent fe0deca commit de06535

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The app `environment` for any Apns* option is "development" for XCode installs,
128128
#### Firebase Cloud Messaging
129129

130130
You will need two params to make use of FCM via Rpush.
131-
- `firebase_project_id` - The `Project ID` in your Firebase Project Settings
131+
- `firebase_project_id` - The `Project number` in your Firebase Project Settings
132132
- `json_key` - The JSON key file for a service account with the `Firebase Admin SDK Administrator Service Agent` role.
133133

134134
Create service account in the google cloud account attached to your firebase account:
@@ -151,6 +151,7 @@ fcm_app.save!
151151
n = Rpush::Fcm::Notification.new
152152
n.app = Rpush::Fcm::App.where(name: "fcm_app").first
153153
n.device_token = device_token # Note that device_token is used here instead of registration_ids
154+
n.notification = { title: "push title", body: "hi mom!" } # either title or body needs to be set, or nothing goes through
154155
n.data = {}.transform_values(&:to_s) # All values going in here have to be strings, if you have anything else - nothing goes through
155156
n.save!
156157
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy