Skip to content

Commit cf701cb

Browse files
committed
two-communication-services-articles
1 parent 9a14eb7 commit cf701cb

File tree

5 files changed

+148
-134
lines changed

5 files changed

+148
-134
lines changed

articles/communication-services/how-tos/calling-sdk/includes/push-notifications/push-notifications-android.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@ ms.topic: include
55
ms.date: 08/06/2024
66
ms.author: sanathr
77
---
8-
> [!IMPORTANT]
9-
> On June 20, 2023, Google announced that it [deprecated sending messages using the FCM legacy APIs](https://firebase.google.com/docs/cloud-messaging). Google is removing the legacy FCM from service in June 2024. Google recommends [migrating from legacy FCM APIs to FCM HTTP v1](https://firebase.google.com/docs/cloud-messaging/migrate-v1).
10-
> Please follow this [migration guide](/azure/communication-services/tutorials/call-chat-migrate-android-push-fcm-v1) if your Communication reosurce is still using the old FCM legacy APIs.
11-
12-
[!INCLUDE [Install SDK](../install-sdk/install-sdk-android.md)]
138

14-
### Additional Prerequisites for Push Notifications
9+
- A Firebase account with Firebase Cloud Messaging (FCM) enabled and with your FCM service connected to an Azure Notification Hubs instance. For more information, see [Communication Services notifications](../../../../concepts/notifications.md).
10+
- Android Studio version 3.6 or later to build your application.
11+
- A set of permissions to enable the Android application to receive notification messages from FCM. In your `AndroidManifest.xml` file, add the following permissions right after `<manifest ...>` or below the `</application>` tag:
1512

16-
A Firebase account set up with Cloud Messaging (FCM) enabled and with your Firebase Cloud Messaging service connected to an Azure Notification Hub instance. See [Communication Services notifications](../../../../concepts/notifications.md) for more information.
17-
Additionally, the tutorial assumes you're using Android Studio version 3.6 or higher to build your application.
13+
```xml
14+
<uses-permission android:name="android.permission.INTERNET"/>
15+
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
16+
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
17+
```
1818

19-
A set of permissions is required for the Android application in order to be able to receive notifications messages from Firebase Cloud Messaging. In your `AndroidManifest.xml` file, add the following set of permissions right after the `<manifest ...>` or below the `</application>` tag.
19+
> [!IMPORTANT]
20+
> On June 20, 2023, Google announced that it [deprecated sending messages by using the FCM legacy APIs](https://firebase.google.com/docs/cloud-messaging) and would start removing the legacy FCM from service in June 2024. Google recommends [migrating from legacy FCM APIs to FCM HTTP v1](https://firebase.google.com/docs/cloud-messaging/migrate-v1).
21+
>
22+
> If your Communication Services resource is still using the FCM legacy APIs, follow [this migration guide](/azure/communication-services/tutorials/call-chat-migrate-android-push-fcm-v1).
2023
21-
```xml
22-
<uses-permission android:name="android.permission.INTERNET"/>
23-
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
24-
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
25-
```
24+
## Considerations for mobile push notifications
2625

27-
## Overview
28-
Mobile push notifications are the pop-up notifications you see on mobile devices. For calling, we'll be focusing on VoIP (Voice over Internet Protocol) push notifications. We register for push notifications, handle push notifications, and then unregister push notifications.
26+
Mobile push notifications are the pop-up notifications that appear on mobile devices. For calling, this article focuses on voice over Internet Protocol (VoIP) push notifications.
2927

3028
> [!NOTE]
31-
> Registering for Push Notifications and handling of the incoming Push Notifications for a Teams user, the APIs are the same. The APIs described here can also be invoked on the `CommonCallAgent` or `TeamsCallAgent` classes.
29+
> When the application registers for push notifications and handles the incoming push notifications for a Teams user, the APIs are the same. The APIs that this article describes can also be invoked on the `CommonCallAgent` or `TeamsCallAgent` class.
30+
31+
[!INCLUDE [Install SDK](../install-sdk/install-sdk-android.md)]
3232

3333
## Register for push notifications
3434

35-
To register for push notifications, the application needs to call `registerPushNotification()` on a `CallAgent` instance with a device registration token.
35+
To register for push notifications, the application needs to call `registerPushNotification()` on a `CallAgent` instance by using a device registration token.
3636

37-
To obtain the device registration token, add the Firebase SDK to your application module's `build.gradle` file by adding the following lines in the `dependencies` section if it's not already there:
37+
To obtain the device registration token, add the Firebase SDK to your application module's `build.gradle` file by adding the following lines in the `dependencies` section (if the lines aren't already there):
3838

3939
```groovy
4040
// Add the SDK for Firebase Cloud Messaging
@@ -48,13 +48,13 @@ In your project level's *build.gradle* file, add the following line in the `depe
4848
classpath 'com.google.gms:google-services:4.3.3'
4949
```
5050

51-
Add the following plugin to the beginning of the file if it's not already there:
51+
Add the following plug-in to the beginning of the file if it's not already there:
5252

5353
```groovy
5454
apply plugin: 'com.google.gms.google-services'
5555
```
5656

57-
Select *Sync Now* in the toolbar. Add the following code snippet to get the device registration token generated by the Firebase Cloud Messaging SDK for the client application instance. Be sure to add the below imports to the header of the main Activity for the instance to retrieve the token.
57+
On the toolbar, select **Sync Now**. Add the following code snippet to get the device registration token that the Firebase Cloud Messaging SDK generated for the client application instance. Be sure to add the following imports to the header of the main activity for the instance to retrieve the token.
5858

5959
```java
6060
import com.google.android.gms.tasks.OnCompleteListener;
@@ -75,13 +75,14 @@ FirebaseInstanceId.getInstance().getInstanceId()
7575
return;
7676
}
7777

78-
// Get new Instance ID token
78+
// Get the new instance ID token
7979
String deviceToken = task.getResult().getToken();
8080
// Log
8181
Log.d("PushNotification", "Device Registration token retrieved successfully");
8282
}
8383
});
8484
```
85+
8586
Register the device registration token with the Calling Services SDK for incoming call push notifications:
8687

8788
```java
@@ -94,19 +95,19 @@ catch(Exception e) {
9495
}
9596
```
9697

97-
## Push notification handling
98+
## Handle push notifications
9899

99-
To receive incoming call push notifications, call *handlePushNotification()* on a *CallAgent* instance with a payload.
100+
To receive incoming call push notifications, call `handlePushNotification()` on a `CallAgent` instance with a payload.
100101

101-
To obtain the payload from Firebase Cloud Messaging, begin by creating a new Service (File > New > Service > Service) that extends the *FirebaseMessagingService* Firebase SDK class and override the `onMessageReceived` method. This method is the event handler called when Firebase Cloud Messaging delivers the push notification to the application.
102+
To obtain the payload from Firebase Cloud Messaging, begin by creating a new service (select **File** > **New** > **Service** > **Service**) that extends the `FirebaseMessagingService` Firebase SDK class and overrides the `onMessageReceived` method. This method is the event handler that's called when Firebase Cloud Messaging delivers the push notification to the application.
102103

103104
```java
104105
public class MyFirebaseMessagingService extends FirebaseMessagingService {
105106
private java.util.Map<String, String> pushNotificationMessageDataFromFCM;
106107

107108
@Override
108109
public void onMessageReceived(RemoteMessage remoteMessage) {
109-
// Check if message contains a notification payload.
110+
// Check if the message contains a notification payload.
110111
if (remoteMessage.getNotification() != null) {
111112
Log.d("PushNotification", "Message Notification Body: " + remoteMessage.getNotification().getBody());
112113
}
@@ -116,6 +117,7 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService {
116117
}
117118
}
118119
```
120+
119121
Add the following service definition to the `AndroidManifest.xml` file, inside the `<application>` tag:
120122

121123
```xml
@@ -128,7 +130,7 @@ Add the following service definition to the `AndroidManifest.xml` file, inside t
128130
</service>
129131
```
130132

131-
Once the payload is retrieved, it can be passed to the *Communication Services* SDK to be parsed out into an internal *IncomingCallInformation* object that will handle calling the *handlePushNotification* method on a *CallAgent* instance. A `CallAgent` instance is created by calling the `createCallAgent(...)` method on the `CallClient` class.
133+
After you retrieve the payload, you can pass it to the Communication Services SDK to be parsed into an internal `IncomingCallInformation` object. This object handles calling the `handlePushNotification` method on a `CallAgent` instance. You create a `CallAgent` instance by calling the `createCallAgent(...)` method on the `CallClient` class.
132134

133135
```java
134136
try {
@@ -140,11 +142,11 @@ catch(Exception e) {
140142
}
141143
```
142144

143-
When the handling of the Push notification message is successful, and the all events handlers are registered properly, the application rings.
145+
When the handling of the push notification message is successful, and the all event handlers are registered properly, the application rings.
144146

145147
## Unregister push notifications
146148

147-
Applications can unregister push notification at any time. Call the `unregisterPushNotification()` method on callAgent to unregister.
149+
Applications can unregister push notification at any time. To unregister, call the `unregisterPushNotification()` method on `callAgent`:
148150

149151
```java
150152
try {
@@ -155,13 +157,14 @@ catch(Exception e) {
155157
}
156158
```
157159

158-
## Disable internal push for incoming call
160+
## Disable internal push notifications for an incoming call
161+
162+
The push payload of an incoming call can be delivered to the callee in two ways:
159163

160-
There are two ways that a push payload of an incoming call can be delivered to the callee.
161-
- Using FCM and registering the device token with the API mentioned above, `registerPushNotification` on `CallAgent` or `TeamsCallAgent`.
162-
- When a `CallAgent` or `TeamsCallAgent` is created, SDK also registers with an internal service to get the push payload delivered.
164+
- Using FCM and registering the device token with the API mentioned earlier, `registerPushNotification` on `CallAgent` or `TeamsCallAgent`
165+
- Registering the SDK with an internal service upon creation of `CallAgent` or `TeamsCallAgent` to get the push payload delivered
163166

164-
Using the property `setDisableInternalPushForIncomingCall` in `CallAgentOptions` or `TeamsCallAgentOptions` it's possible to instruct the SDK to disable the delivery of the push payload using the internal push service.
167+
By using the property `setDisableInternalPushForIncomingCall` in `CallAgentOptions` or `TeamsCallAgentOptions`, it's possible to instruct the SDK to disable the delivery of the push payload via the internal push service:
165168

166169
```java
167170
CallAgentOptions callAgentOptions = new CallAgentOptions();

articles/communication-services/how-tos/calling-sdk/includes/push-notifications/push-notifications-ios.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,30 @@ ms.topic: include
55
ms.date: 09/08/2021
66
ms.author: rifox
77
---
8-
[!INCLUDE [Install SDK](../install-sdk/install-sdk-ios.md)]
8+
## Considerations for mobile push notifications
99

10-
## Overview
11-
Mobile push notifications are the pop-up notifications you see on mobile devices. For calling, we'll be focusing on VoIP (Voice over Internet Protocol) push notifications. We'll register for push notifications, handle push notifications, and then un-register push notifications. For a guide on CallKit integration in your iOS application, refer here, [CallKit integration with iOS ACS SDK](../../callkit-integration.md).
10+
Mobile push notifications are the pop-up notifications that appear on mobile devices. For calling, this article focuses on voice over Internet Protocol (VoIP) push notifications. For a guide on CallKit integration in your iOS application, see [Integrate with CallKit](../../callkit-integration.md).
1211

1312
> [!NOTE]
14-
> Registering for Push Notifications and handling of the incoming Push Notifications for a Teams user, the APIs are the same. The APIs described here can also be invoked on the `CommonCallAgent` or `TeamsCallAgent` classes.
13+
> When the application registers for push notifications and handles the incoming push notifications for a Teams user, the APIs are the same. The APIs that this article describes can also be invoked on the `CommonCallAgent` or `TeamsCallAgent` class.
1514
16-
## Set up push notifications
15+
[!INCLUDE [Install SDK](../install-sdk/install-sdk-ios.md)]
1716

18-
A mobile push notification is the pop-up notification that you get in the mobile device. For calling, we'll focus on VoIP (voice over Internet Protocol) push notifications.
17+
### Set up push notifications
1918

20-
The following sections describe how to register for, handle, and unregister push notifications. Before you start those tasks, complete these prerequisites:
19+
Before you start the tasks of registering for, handling, and unregistering push notifications, complete this setup task:
2120

2221
1. In Xcode, go to **Signing & Capabilities**. Add a capability by selecting **+ Capability**, and then select **Push Notifications**.
2322
2. Add another capability by selecting **+ Capability**, and then select **Background Modes**.
2423
3. Under **Background Modes**, select the **Voice over IP** and **Remote notifications** checkboxes.
2524

2625
:::image type="content" source="../../../../quickstarts/voice-video-calling/media/ios/xcode-push-notification.png" alt-text="Screenshot that shows how to add capabilities in Xcode." lightbox="../../../../quickstarts/voice-video-calling/media/ios/xcode-push-notification.png":::
2726

28-
### Register for push notifications
27+
## Register for push notifications
2928

30-
To register for push notifications, call `registerPushNotification()` on a `CallAgent` instance with a device registration token.
29+
To register for push notifications, call `registerPushNotification()` on a `CallAgent` instance by using a device registration token.
3130

32-
Registration for push notifications needs to happen after successful initialization. When the `callAgent` object is destroyed, `logout` will be called, which will automatically unregister push notifications.
31+
Registration for push notifications needs to happen after successful initialization. When the `callAgent` object is destroyed, `logout` is called, which automatically unregisters push notifications.
3332

3433
```swift
3534
let deviceToken: Data = pushRegistry?.pushToken(for: PKPushType.voIP)
@@ -43,7 +42,8 @@ callAgent.registerPushNotifications(deviceToken: deviceToken!) { (error) in
4342
```
4443

4544
## Handle push notifications
46-
To receive push notifications for incoming calls, call `handlePushNotification()` on a `CallAgent` instance with a dictionary payload.
45+
46+
To receive push notifications for incoming calls, call `handlePushNotification()` on a `CallAgent` instance with a dictionary payload:
4747

4848
```swift
4949
let callNotification = PushNotificationInfo.fromDictionary(pushPayload.dictionaryPayload)
@@ -56,9 +56,10 @@ callAgent.handlePush(notification: callNotification) { (error) in
5656
}
5757
}
5858
```
59+
5960
## Unregister push notifications
6061

61-
Applications can unregister push notification at any time. Simply call the `unregisterPushNotification` method on `CallAgent`.
62+
Applications can unregister push notification at any time. To unregister, call the `unregisterPushNotification` method on `CallAgent`.
6263

6364
> [!NOTE]
6465
> Applications are not automatically unregistered from push notifications on logout.
@@ -73,13 +74,14 @@ callAgent.unregisterPushNotification { (error) in
7374
}
7475
```
7576

76-
## Disable internal push for incoming call
77+
## Disable internal push notifications for an incoming call
78+
79+
The push payload of an incoming call can be delivered to the callee in two ways:
7780

78-
There are 2 ways that a push payload of an incoming call can be delivered to the callee.
79-
- Using APNS and registering the device token with the API mentioned above, `registerPushNotification` on `CallAgent` or `TeamsCallAgent`.
80-
- When a `CallAgent` or `TeamsCallAgent` is created, SDK also registers with an internal service to get the push payload delivered.
81+
- Using Apple Push Notification service (APNS) and registering the device token with the API mentioned earlier, `registerPushNotification` on `CallAgent` or `TeamsCallAgent`
82+
- Registering the SDK with an internal service upon creation of `CallAgent` or `TeamsCallAgent` to get the push payload delivered
8183

82-
Using the property `disableInternalPushForIncomingCall` in `CallAgentOptions` or `TeamsCallAgentOptions` it's possible to instruct the SDK to disable the delivery of the push payload using the internal push service.
84+
By using the property `disableInternalPushForIncomingCall` in `CallAgentOptions` or `TeamsCallAgentOptions`, it's possible to instruct the SDK to disable the delivery of the push payload via the internal push service:
8385

8486
```swift
8587
let options = CallAgentOptions()
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
22
author: chriswhilar
33
title: Azure Communication Services Web Calling SDK - Web push notifications
4-
description: Quickstart tutorial for Azure Communication Services Web Calling SDK push notifications
4+
description: Find the quickstart for setting up Azure Communication Services Web Calling SDK push notifications.
55
ms.service: azure-communication-services
66
ms.subservice: web calling sdk
77
ms.topic: include
88
ms.date: 03/20/2023
99
ms.author: chwhilar
1010
---
1111

12-
Azure Communication Services Web Calling SDK - Web push notifications quickstart
12+
## Follow the quickstart
13+
14+
Web push notifications via the Azure Communication Services Web Calling SDK are in preview and are available as part of version 1.12.0-beta.2+.
1315

1416
[!INCLUDE [Public Preview Disclaimer](../../../../includes/public-preview-include.md)]
15-
Azure Communication Services Web Calling SDK - Web push notifications are in public preview and available as part of version 1.12.0-beta.2+.
1617

17-
Please visit our web push notifications quickstart tutorial: https://github.com/Azure-Samples/communication-services-javascript-quickstarts/blob/main/calling-web-push-notifications/README.md
18+
For step-by-step instructions, see the [quickstart on GitHub](https://github.com/Azure-Samples/communication-services-javascript-quickstarts/blob/main/calling-web-push-notifications/README.md).

0 commit comments

Comments
 (0)