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: README.md
+39-18Lines changed: 39 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Tested with:
16
16
17
17
The most updated branch is [feat/twilio-android-sdk-5](https://github.com/hoxfon/react-native-twilio-programmable-voice/tree/feat/twilio-android-sdk-5) which is aligned with:
18
18
19
-
- Android 5.1.1
19
+
- Android 5.2.0
20
20
- iOS 5.2.0
21
21
22
22
It contains breaking changes from `react-native-twilio-programmable-voice` v4, and it will be released as v5.
@@ -54,17 +54,19 @@ Allow Android to use the built in Android telephony service to make and receive
54
54
- Android 4.5.0
55
55
- iOS 5.2.0
56
56
57
-
58
57
### Breaking changes in v5.0.0
59
58
60
-
Changes on [Android Twilio Voice SDK v5](https://www.twilio.com/docs/voice/voip-sdk/android/3x-changelog#500) are reflected in the JavaScript API, the way call invites are handled and ...
59
+
Changes on [Android Twilio Voice SDK v5](https://www.twilio.com/docs/voice/voip-sdk/android/3x-changelog#500) are reflected in the JavaScript API, the way call invites are handled has changed and other v5 features like `audioSwitch` have been implemented.
60
+
`setSpeakerPhone()` has been removed, use selectAudioDevice(name: string) instead.
61
+
62
+
#### Background incoming calls
61
63
62
-
-when the app is not in foreground incoming calls result in a heads-up notification with action to "ACCEPT" and "REJECT"
63
-
- ReactMethod `accept` does not dispatch any event. Previously it would dispatch `connectionDidDisconnect`
64
-
- ReactMethod `reject`dispatch a `callInviteCancelled` event instead of `connectionDidDisconnect`
65
-
- ReactMethod `ignore` does not dispatch any event. Previously it would dispatch `connectionDidDisconnect`
64
+
-When the app is not in foreground incoming calls result in a heads-up notification with action to "ACCEPT" and "REJECT".
65
+
- ReactMethod `accept` does not dispatch any event. In v4 it dispatched `connectionDidDisconnect`.
66
+
- ReactMethod `reject`dispatches a `callInviteCancelled` event instead of `connectionDidDisconnect`.
67
+
- ReactMethod `ignore` does not dispatch any event. In v4 it dispatched `connectionDidDisconnect`.
66
68
67
-
To allow the library to show heads up notifications you must add the following lines to your application `android/app/src/main/AndroidManifest.xml`:
69
+
To show heads up notifications, you must add the following lines to your application's`android/app/src/main/AndroidManifest.xml`:
68
70
69
71
```xml
70
72
<!-- receive calls when the app is in the background-->
@@ -97,22 +99,22 @@ To allow the library to show heads up notifications you must add the following l
97
99
</application>
98
100
```
99
101
100
-
Firebase Messaging 19.0.+ is imported by this module, so there is no need to import it in your app.
102
+
Firebase Messaging 19.0.+ is imported by this module, so there is no need to import it in your app's `bundle.gradle` file.
101
103
102
-
Previously, in order to launch the app when receiving a call, the flow was:
104
+
In v4 the flow to launch the app when receiving a call was:
103
105
104
-
1. the module would launch the app
105
-
2. after the React app is initialised, it would always ask to the native module whether there were incoming call invites
106
-
3. if there where any incoming call invites the module would send an event to the React app with the incoming call invite parameters
107
-
4. the Reach app would listen to the event and launch the view with the appropriate incoming call answer/reject controls
106
+
1. the module launched the app
107
+
2. after the React app is initialised, it always asked to the native module whether there were incoming call invites
108
+
3. if there were any incoming call invites, the module would have sent an event to the React app with the incoming call invite parameters
109
+
4. the Reach app would have listened to the event and would have launched the view with the appropriate incoming call answer/reject controls
108
110
109
-
This loop was long and prone to race conditions. In case the event was sent before the React main view was completely initialised, it would not be handled at all.
111
+
This loop was long and prone to race conditions. For example,when the event was sent before the React main view was completely initialised, it would not be handled at all.
110
112
111
-
Version 5.0.0 replaces the previous flow by using `getLaunchOptions()` to pass initial properties from native to React when receiving a call invite as explained here: https://reactnative.dev/docs/communication-android.
113
+
V5 replaces the previous flow by using `getLaunchOptions()` to pass initial properties from the native module to React, when receiving a call invite as explained here: https://reactnative.dev/docs/communication-android.
112
114
113
-
The React app will be launched with the initial properties `callInvite` or `call`.
115
+
The React app is launched with the initial properties `callInvite` or `call`.
114
116
115
-
Add the following blocks to your app's `MainActivity`:
117
+
To handle correctly `lauchedOptions`, you must add the following blocks to your app's `MainActivity`:
116
118
117
119
```java
118
120
@@ -154,6 +156,25 @@ public class MainActivity extends ReactActivity {
154
156
}
155
157
```
156
158
159
+
#### Audio Switch
160
+
161
+
Access to native Twilio SDK AudioSwitch module has been added to the JavaScript API:
162
+
163
+
```javascript
164
+
// getAudioDevices returns all audio devices connected
165
+
// {
166
+
// "Speakerphone": false,
167
+
// "Earnpiece": true, // true indicates the selected device
168
+
// }
169
+
getAudioDevices()
170
+
171
+
// getSelectedAudioDevice returns the selected audio device
172
+
getSelectedAudioDevice()
173
+
174
+
// selectAudioDevice selects the passed audio device for the current active call
0 commit comments