Skip to content

Commit 78985fb

Browse files
committed
Update chat-android-push-notification.md
fixed warnings
1 parent b23d228 commit 78985fb

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

articles/communication-services/tutorials/chat-android-push-notification.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ description: Learn how to enable push notification in Android App by using Azure
55
author: jiminwen
66
services: azure-communication-services
77
ms.author: jiminwen
8-
ms.date: 08/16/2022
8+
ms.date: 06/28/2025
99
ms.topic: tutorial
1010
ms.service: azure-communication-services
1111
---
1212

1313

1414
# Enable push notifications in Android
1515

16-
Push notifications enable clients to be notified for incoming messages and other operations occurring in a chat thread in situations where the mobile app isn't running in the foreground. Azure Communication Services supports a [list of events that you can subscribe to](../concepts/chat/concepts.md#push-notifications).
16+
Push notifications enable clients to be notified of incoming messages and other operations occurring in a chat thread when the mobile app isn't running in the foreground. Azure Communication Services supports a [list of events that you can subscribe to](../concepts/chat/concepts.md#push-notifications).
1717

1818
> [!NOTE]
19-
> Chat push notifications are supported for Android SDK in versions starting from 1.1.0-beta.4 and 1.1.0. It is recommended that you use version 2.0.0 or newer, as older versions have a known issue with the registration renewal. Steps from 8 to 12 are only needed for versions equal to or greater than 2.0.0.
19+
> Chat push notifications are supported for Android SDK in versions starting from 1.1.0-beta.4 and 1.1.0. We recommended that you use version 2.0.0 or newer, as older versions have a known issue with the registration renewal. Steps from 8 to 12 are only needed for versions equal to or greater than 2.0.0.
2020
2121
1. Set up Firebase Cloud Messaging for the ChatQuickstart project. Complete steps `Create a Firebase project`, `Register your app with Firebase`, `Add a Firebase configuration file`, `Add Firebase SDKs to your app`, and `Edit your app manifest` in [Firebase Documentation](https://firebase.google.com/docs/cloud-messaging/android/client).
2222

2323
2. Create a Notification Hub within the same subscription as your Communication Services resource, configure your Firebase Cloud Messaging settings for the hub, and link the Notification Hub to your Communication Services resource. See [Notification Hub provisioning](../concepts/notifications.md#notification-hub-provisioning).
24-
3. Create a new file called `MyFirebaseMessagingService.java` in the same directory where `MainActivity.java` resides. Copy the following code into `MyFirebaseMessagingService.java`. You will need to replace `<your_package_name>` with the package name used in `MainActivity.java`. You can use your own value for `<your_intent_name>`. This value will be used in step 6 below.
24+
25+
3. Create a new file called `MyFirebaseMessagingService.java` in the same directory where `MainActivity.java` resides. Copy the following code into `MyFirebaseMessagingService.java`. You need to replace `<your_package_name>` with the package name used in `MainActivity.java`. You can use your own value for `<your_intent_name>`. Use this value in step **6**.
2526

2627
```java
2728
package <your_package_name>;
@@ -149,7 +150,7 @@ Push notifications enable clients to be notified for incoming messages and other
149150
}
150151
```
151152

152-
7. Put the following code below the comment `<RECEIVE CHAT MESSAGES>` in `MainActivity`:
153+
7. Put the following code after the comment `<RECEIVE CHAT MESSAGES>` in `MainActivity`:
153154

154155
```java
155156
startFcmPushNotification();
@@ -220,11 +221,12 @@ Push notifications enable clients to be notified for incoming messages and other
220221
}
221222
}
222223
```
223-
**Explanation to code above:** The default initializer of `WorkManager` has been disabled in step 9. This step implements `Configuration.Provider` to provide a customized 'WorkFactory', which is responsible to create `WorkerManager` during runtime.
224224

225-
If the app is integrated with Azure Function, initialization of application parameters should be added in method 'onCreate()'. Method 'getWorkManagerConfiguration()' is called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created, so that application parameters could be initialized before being used. More details can be found in the sample chat app.
225+
**Explanation of the preceding code:** The default initializer of `WorkManager` is disabled in step **9**. This step implements `Configuration.Provider` to provide a customized `WorkFactory`, which is responsible to create `WorkerManager` during runtime.
226+
227+
If the app is integrated with Azure Function, initialize the application parameters in method `onCreate()`. Method `getWorkManagerConfiguration()` is called when the application is starting, before any activity, service, or receiver objects (excluding content providers) are created, so application parameters can be initialized before use. For more details, see the sample chat app.
226228

227-
12. Add the `android:name=.MyAppConfiguration` field, which uses the class name from step 11, into `AndroidManifest.xml`:
229+
12. Add the `android:name=.MyAppConfiguration` field, which uses the class name from step **11**, into `AndroidManifest.xml`:
228230

229231
```
230232
<application
@@ -238,7 +240,7 @@ If the app is integrated with Azure Function, initialization of application para
238240
>
239241
```
240242

241-
## Related topics
243+
## Related articles
242244

243245
- [Migrate Android SDK push notifications to FCM v1](./call-chat-migrate-android-push-fcm-v1.md)
244246
- [Register for Android SDK push notifications using FCM v1](./call-chat-register-android-push-fcm-v1.md)

0 commit comments

Comments
 (0)