Skip to content

Commit bbbc490

Browse files
authored
Merge pull request #216767 from rzdor/main
Add raise hand feature for android sdk
2 parents 1531dc6 + 95c60c1 commit bbbc490

File tree

4 files changed

+103
-1
lines changed

4 files changed

+103
-1
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
author: ruslanzdor
3+
ms.service: azure-communication-services
4+
ms.topic: include
5+
ms.date: 11/01/2022
6+
ms.author: ruslanzdor
7+
---
8+
[!INCLUDE [Install SDK](../install-sdk/install-sdk-android.md)]
9+
10+
> [!NOTE]
11+
> Raise Hand API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. To use this api please use 'alpha' release of Azure Communication Services Calling Web SDK
12+
13+
Raise Hand is an extended feature of the core `Call` API. You first need to import calling Features from the Calling SDK:
14+
15+
```js
16+
import com.azure.android.communication.calling.RaiseHandFeature;
17+
```
18+
19+
Then you can get the feature API object from the call instance:
20+
21+
```js
22+
RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
23+
```
24+
25+
### Raise and lower hand for current participant:
26+
Raise Hand state can be used in any call type: on 1:1 calls and on calls with many participants, in ACS and in Teams calls.
27+
If it Teams meeting - organizer will have ability to enable or disable raise hand states for all participants.
28+
To change state for current participant, you can use methods:
29+
```js
30+
RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
31+
//raise
32+
raiseHandFeature.raiseHand();
33+
//lower
34+
raiseHandFeature.lowerHand();
35+
```
36+
37+
### Lower hands for other participants
38+
Currently ACS calls aren't allowed to change state of other participants, for example, lower all hands. But Teams calls allow it using these methods:
39+
```js
40+
RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
41+
//lower all hands on the call
42+
raiseHandFeature.lowerHandForEveryone();
43+
//or we can provide array of CommunicationIdentifier to specify list of participants
44+
List<CommunicationIdentifier> identifiers = new ArrayList<>();
45+
CommunicationUserIdentifier acsUser = new CommunicationUserIdentifier(<USER_ID>);
46+
MicrosoftTeamsUserIdentifier teamsUser = new MicrosoftTeamsUserIdentifier(<USER_ID>);
47+
identifiers.add(new CommunicationUserIdentifier("<USER_ID>"));
48+
identifiers.add(new MicrosoftTeamsUserIdentifier("<USER_ID>"));
49+
raiseHandFeature.lowerHand(identifiers);
50+
```
51+
52+
### Handle changed states
53+
The `Raise Hand` API allows you to subscribe to `raiseHandChanged` events. A `raiseHandChanged` event comes from a `call` instance and contain information about participant and new state.
54+
```js
55+
RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND)
56+
57+
// event example : {identifier: CommunicationIdentifier, isRaised: true, order:1}
58+
call.feature(Features.RAISE_HAND).addOnRaiseHandReceivedListener(raiseHandEvent -> {
59+
Log.i(TAG, String.format("Raise Hand: %s : %s", Utilities.toMRI(raiseHandEvent.getIdentifier()), raiseHandEvent.isRaised()));
60+
});
61+
```
62+
63+
### List of all participants with active state
64+
To get information about all participants that have Raise Hand state on current call, you can use this api array is sorted by order field:
65+
```js
66+
RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
67+
List<RaiseHand> activeStates = raiseHandFeature.getStatus();
68+
```
69+
70+
### Order of raised Hands
71+
It possible to get order of all raised hand states on the call, this order is started from 1.
72+
There are two ways: get all raise hand state on the call or use `raiseHandChanged` event subscription.
73+
In event subscription when any participant will lower a hand - call will generate only one event, but not for all participants with order above.
74+
75+
```js
76+
const raiseHandFeature = call.feature(Features.RaiseHand );
77+
for (RaiseHand state : raiseHandFeature.getStatus() {
78+
CommunicationIdentifier identifier = state.getIdentifier();
79+
int order = state.getOrder();
80+
}
81+
82+
83+
// event example: {identifier: CommunicationIdentifier, isRaised: true, order:1}
84+
call.feature(Features.RAISE_HAND).addOnRaiseHandReceivedListener(raiseHandEvent -> {
85+
Log.i(TAG, String.format("Raise Hand: %s : %s", Utilities.toMRI(raiseHandEvent.getIdentifier()), raiseHandEvent.getOrder()));
86+
});
87+
```

articles/communication-services/how-tos/calling-sdk/includes/raise-hand/raise-hand-web.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.author: rifox
88
[!INCLUDE [Install SDK](../install-sdk/install-sdk-web.md)]
99

1010
> [!NOTE]
11-
> Raise Hand API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. To use this api please use 'beta' release of Azure Communication Services Calling Web SDK
11+
> Raise Hand API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. To use this api please use 'alpha' release of Azure Communication Services Calling Web SDK
1212
1313
Raise Hand is an extended feature of the core `Call` API. You first need to import calling Features from the Calling SDK:
1414

articles/communication-services/how-tos/calling-sdk/raise-hand.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ms.subservice: calling
99
ms.topic: how-to
1010
ms.date: 09/09/2022
1111
ms.custom: template-how-to
12+
zone_pivot_groups: acs-web-android
1213

1314
#Customer intent: As a developer, I want to learn how to send and receive Raise Hand state using SDK.
1415
---
@@ -26,7 +27,13 @@ During an active call, you may want to send or receive states from other users.
2627
- A user access token to enable the calling client. For more information, see [Create and manage access tokens](../../quickstarts/access-tokens.md).
2728
- Optional: Complete the quickstart to [add voice calling to your application](../../quickstarts/voice-video-calling/getting-started-with-calling.md)
2829

30+
::: zone pivot="platform-web"
2931
[!INCLUDE [Raise Hand Client-side JavaScript](./includes/raise-hand/raise-hand-web.md)]
32+
::: zone-end
33+
34+
::: zone pivot="platform-android"
35+
[!INCLUDE [Raise Hand Client-side Android](./includes/raise-hand/raise-hand-android.md)]
36+
::: zone-end
3037

3138
## Next steps
3239
- [Learn how to manage calls](./manage-calls.md)

articles/zone-pivot-groups.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,14 @@ groups:
10721072
title: Web
10731073
- id: platform-ios
10741074
title: iOS
1075+
- id: acs-web-android
1076+
title: Platform
1077+
prompt: Choose a platform
1078+
pivots:
1079+
- id: platform-web
1080+
title: Web
1081+
- id: platform-android
1082+
title: Android
10751083
- id: acs-js-csharp-ios-android-python
10761084
title: Programming languages
10771085
prompt: Choose a programming language

0 commit comments

Comments
 (0)