Skip to content

Commit 0e6ac83

Browse files
committed
Add missing Android methods
1 parent 596d28d commit 0e6ac83

File tree

3 files changed

+52
-10
lines changed

3 files changed

+52
-10
lines changed

README.md

+42-8
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ RNCallKeep.setActive(true);
8484
```
8585

8686
- `active`: boolean
87-
- Tell whenever the app is ready or not
87+
- Tell whenever the app is ready or not
8888

8989
### displayIncomingCall
9090

@@ -95,11 +95,11 @@ RNCallKeep.displayIncomingCall(uuid, handle);
9595
````
9696

9797
- `uuid`: string
98-
- An `uuid` that should be stored and re-used for `stopCall`.
98+
- An `uuid` that should be stored and re-used for `stopCall`.
9999
- `handle`: string
100-
- Phone number of the caller
100+
- Phone number of the caller
101101
- `localizedCallerName`: string (optional, iOS only)
102-
- Name of the caller to be displayed on the native UI
102+
- Name of the caller to be displayed on the native UI
103103
- `handleType`: string (optional, iOS only)
104104
- `generic`
105105
- `number` (default)
@@ -119,9 +119,9 @@ RNCallKeep.startCall(uuid, number);
119119
```
120120

121121
- _uuid_: string
122-
- An `uuid` that should be stored and re-used for `stopCall`.
122+
- An `uuid` that should be stored and re-used for `stopCall`.
123123
- `handle`: string
124-
- Phone number of the callee
124+
- Phone number of the callee
125125
- `handleType`: string (optional)
126126
- `generic`
127127
- `number` (default)
@@ -139,7 +139,7 @@ RNCallKeep.endCall(uuid);
139139
```
140140

141141
- `uuid`: string
142-
- The `uuid` used for `startCall` or `displayIncomingCall`
142+
- The `uuid` used for `startCall` or `displayIncomingCall`
143143

144144

145145
### setMutedCall
@@ -152,7 +152,7 @@ RNCallKeep.setMutedCall(uuid, true);
152152
```
153153

154154
- `uuid`: string
155-
- uuid of the current call.
155+
- uuid of the current call.
156156
- `muted`: boolean
157157

158158
### checkIfBusy
@@ -173,6 +173,29 @@ _This feature is available only on iOs._
173173
RNCallKeep.checkSpeaker();
174174
```
175175

176+
### supportConnectionService (async)
177+
178+
Tells if `ConnectionService` is available on the device (returns a boolean).
179+
180+
_This feature is available only on Android._
181+
182+
```js
183+
RNCallKeep.supportConnectionService();
184+
```
185+
186+
### hasPhoneAccount (async)
187+
188+
Checks if the user has enabled the [phone account](https://developer.android.com/reference/android/telecom/PhoneAccount) for your application.
189+
A phone account must be enable to be able to display UI screen on incoming call and make outgoing calls from native Contact application.
190+
191+
Returns a promise of a boolean.
192+
193+
_This feature is available only on Android._
194+
195+
```js
196+
await RNCallKeep.hasPhoneAccount();
197+
```
198+
176199
## Events
177200

178201
### didReceiveStartCallAction
@@ -250,6 +273,17 @@ A call was muted by the system or the user:
250273
```js
251274
RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted }) => {
252275

276+
});
277+
278+
```
279+
### - didPerformDTMFAction
280+
_This feature is available only on Android for now._
281+
282+
Used type a number on his dialer
283+
284+
```js
285+
RNCallKeep.addEventListener('didPerformDTMFAction', ({ dtmf }) => {
286+
253287
});
254288
```
255289

index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { listeners } from './actions'
44

55
const RNCallKeepModule = NativeModules.RNCallKeep;
66
const isIOS = Platform.OS === 'ios';
7-
const hasConnectionService = !isIOS && Platform.Version >= 23;
7+
const supportConnectionService = !isIOS && Platform.Version >= 23;
88

99
class RNCallKeep {
1010

@@ -69,6 +69,14 @@ class RNCallKeep {
6969
isIOS ? RNCallKeepModule.endAllCalls() : RNCallKeepModule.endCall();
7070
}
7171

72+
supportConnectionService() {
73+
return supportConnectionService;
74+
}
75+
76+
async hasPhoneAccount() {
77+
return isIOS ? true : await RNCallKeepModule.hasPhoneAccount();
78+
}
79+
7280
setMutedCAll(uuid, muted) {
7381
if (!isIOS) {
7482
// Can't mute on Android

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-callkeep",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "iOS 10 CallKit and Android ConnectionService Framework For React Native",
55
"main": "index.js",
66
"scripts": {},

0 commit comments

Comments
 (0)