You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/push/getting-started/fcm.mdx
+35-37Lines changed: 35 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@ You'll learn how to set up your application with Firebase Cloud Messaging (FCM),
12
12
13
13
1.[Sign up](https://ably.com/signup) for an Ably account.
14
14
2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard.
15
-
3. Your API key will need the `publish` and `subscribe` capabilities. For sending push notifications from your app, you'll also need the `push-admin` capability.
16
-
4. For channel-based push, add a rule for the channel with **Push notifications enabled** checked. In the dashboard left sidebar: **Configuration** → **Rules** → **Add** or **Edit** a rule, then enable the Push notifications option. See [channel rules](https://ably.com/docs/channels#rules) for details.
15
+
3. Your API key needs the `publish` and `subscribe` capabilities. For sending push notifications from your app, you'll also need the `push-admin` capability.
16
+
4. For channel-based push, add a rule for the channel with **Push notifications enabled** checked. In the dashboard left sidebar: **Configuration** → **Rules** → **Add** or **Edit** a rule, then enable the Push notifications option. See [channel rules](/docs/channels#rules) for details.
key ="{{API_KEY}}"// Use token authentication in production
120
120
clientId ="push-tutorial-client"
121
121
}
122
122
AblyRealtime(options).also {
@@ -241,7 +241,7 @@ Register the service in `AndroidManifest.xml` inside the `<application>` element
241
241
```
242
242
</Code>
243
243
244
-
Now add push activation and deactivation to your `MainActivity.kt`. The Ably Android SDK sends activation results as local broadcasts, so register a `BroadcastReceiver` to handle them:
244
+
Now add push activation and deactivation to your `MainActivity.kt`. The Ably Android SDK activates push asynchronously and the result arrives via Android's broadcast system, so register a `BroadcastReceiver` to handle it (the following imports cover all steps in this guide):
## Step 3: Subscribe and test push notifications <aid="step-3"/>
341
341
342
342
Push notifications delivered while your app is in the background are handled automatically by the FCM SDK and displayed as system notifications. For foreground handling, your `PushNotificationService.onMessageReceived()` method (from Step 2) displays a notification via `NotificationManager`.
343
343
@@ -384,18 +384,17 @@ Also add a realtime channel subscription to receive messages while the app is in
Sending push notifications using `deviceId` or `clientId` requires the `push-admin` capability for your API key. Use this method for testing purposes.
396
-
In a production environment, you would typically send push notifications from your backend server (by posting messages with `push``extras` field to a channel).
393
+
<Aside>
394
+
Sending push notifications using `deviceId` or `clientId` requires the `push-admin` capability for your API key. Use this method for testing purposes. In a production environment, you would typically send push notifications from your backend server (by posting messages with `push``extras` field to a channel).
395
+
</Aside>
397
396
398
-
To test push notifications, use the Ably CLI to send a push to your client ID:
397
+
Now use the Ably CLI to test sending a push notification to your client ID:
@@ -657,7 +655,7 @@ Build and run your app on an Android device or emulator. Tap **Activate Push** a
657
655
658
656
### Send push via channel <aid="step-4-send-channel"/>
659
657
660
-
To test pushes via channel, tap **Subscribe to Channel** in the app and then publish a message to "exampleChannel1" with a `push``extras` field using Ably CLI:
658
+
To test push notifications via channel, tap **Subscribe to Channel** in the app and then publish a message to "exampleChannel1" with a `push``extras` field using Ably CLI:
0 commit comments