@@ -69,13 +69,13 @@ RNCallKeep.setup(options);
69
69
Cancel button label
70
70
- ` okButton ` : string (required)
71
71
Ok button label
72
-
72
+
73
73
## Methods
74
74
75
75
### setAvailable
76
76
_ This feature is available only on Android._
77
77
78
- Tell _ ConnectionService_ that the device is ready to accept outgoing calls.
78
+ Tell _ ConnectionService_ that the device is ready to accept outgoing calls.
79
79
If not the user will be stuck in the build UI screen without any actions.
80
80
Eg: Call it with ` false ` when disconnected from the sip client, when your token expires ...
81
81
@@ -207,6 +207,25 @@ _This feature is available only on Android._
207
207
await RNCallKeep .hasPhoneAccount ();
208
208
```
209
209
210
+ ### hasDefaultPhoneAccount
211
+
212
+ Checks if the user has set a default [ phone account] ( https://developer.android.com/reference/android/telecom/PhoneAccount ) .
213
+ If the user has not set a default they will be prompted to do so with an alert.
214
+
215
+ This is a workaround for an [ issue] ( https://github.com/wazo-pbx/react-native-callkeep/issues/33 ) affecting some Samsung devices.
216
+
217
+ _ This feature is available only on Android._
218
+
219
+ ``` js
220
+ const options = {
221
+ alertTitle: ' Default not set' ,
222
+ alertDescription: ' Please set the default phone account'
223
+ };
224
+
225
+ RNCallKeep .hasDefaultPhoneAccount (options);
226
+ ```
227
+
228
+
210
229
## Events
211
230
212
231
### didReceiveStartCallAction
@@ -219,7 +238,7 @@ After all works are done, remember to call `RNCallKeep.startCall(uuid, calleeNum
219
238
220
239
``` js
221
240
RNCallKeep .addEventListener (' didReceiveStartCallAction' , ({ handle }) => {
222
-
241
+
223
242
});
224
243
```
225
244
@@ -283,7 +302,7 @@ A call was muted by the system or the user:
283
302
284
303
``` js
285
304
RNCallKeep .addEventListener (' didPerformSetMutedCallAction' , (muted ) => {
286
-
305
+
287
306
});
288
307
289
308
```
@@ -293,7 +312,7 @@ A call was held or unheld by the current user
293
312
294
313
``` js
295
314
RNCallKeep .addEventListener (' didToggleHoldCallAction' , ({ hold, callUUID }) => {
296
-
315
+
297
316
});
298
317
```
299
318
@@ -307,7 +326,7 @@ Used type a number on his dialer
307
326
308
327
``` js
309
328
RNCallKeep .addEventListener (' didPerformDTMFAction' , ({ dtmf, callUUID }) => {
310
-
329
+
311
330
});
312
331
```
313
332
@@ -327,9 +346,9 @@ import uuid from 'uuid';
327
346
class RNCallKeepExample extends React .Component {
328
347
constructor (props ) {
329
348
super (props);
330
-
349
+
331
350
this .currentCallId = null ;
332
-
351
+
333
352
// Initialise RNCallKeep
334
353
const options = {
335
354
ios: {
@@ -342,7 +361,7 @@ class RNCallKeepExample extends React.Component {
342
361
okButton: ' ok' ,
343
362
}
344
363
};
345
-
364
+
346
365
347
366
try {
348
367
RNCallKeep .setup (options);
@@ -369,13 +388,13 @@ class RNCallKeepExample extends React.Component {
369
388
onAnswerCallAction = ({ callUUID }) => {
370
389
// called when the user answer the incoming call
371
390
};
372
-
391
+
373
392
onEndCallAction = ({ callUUID }) => {
374
393
RNCallKeep .endCall (this .getCurrentCallId ());
375
-
394
+
376
395
this .currentCallId = null ;
377
396
};
378
-
397
+
379
398
onIncomingCallDisplayed = error => {
380
399
// You will get this event after RNCallKeep finishes showing incoming call UI
381
400
// You can check if there was an error while displaying
@@ -389,7 +408,7 @@ class RNCallKeepExample extends React.Component {
389
408
// you might want to do following things when receiving this event:
390
409
// - Start playing ringback if it is an outgoing call
391
410
};
392
-
411
+
393
412
getCurrentCallId = () => {
394
413
if (! this .currentCallId ) {
395
414
this .currentCallId = uuid .v4 ();
0 commit comments