Skip to content

Commit 02a64a3

Browse files
committed
Draft proposal for some basic self managed documentation
1 parent 28b2b47 commit 02a64a3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ const { CONSTANTS as CK_CONSTANTS, RNCallKeep } from 'react-native-callkeep';
147147
console.log(CK_CONSTANTS.END_CALL_REASONS.FAILED) // outputs 1
148148
```
149149
150+
## Android Self Managed Mode
151+
_This feature is available only on Android._
152+
153+
Android supports calling apps running in what's called "Self Managed". This means the apps are able (and required) to provide their own UI for managing calls. This includes both in call UI elements and incoming call notification UI. This method is all or nothing. You can't mix partial elements, such as having a custom in call view, but use the default incoming call UI.
154+
155+
To implement a self managed calling app, the following steps are necessary:
156+
- Set `selfManaged: true` in setup.
157+
- On an incoming call, from react native, call `RNCallKeep.displayIncomingCall`
158+
- CallKeep will then fire the `showIncomingCallUi` event.
159+
- When `showIncomingCallUi` is fired, you must show an incoming call UI. This would be a high priority notification ([Android: Display time-sensitive notifications](https://developer.android.com/training/notify-user/time-sensitive)).
160+
- If the user answers the call, you call the appropriate RNCallKeep actions such as `answerCall` or `endCall`
161+
162+
Self Managed calling apps are an advanced topic, and there are many steps involved in implementing them, but here are some things to keep in mind:
163+
- React Native Headless Tasks are a great way to execute React Native code. Remember to start up the headless task as a Foreground Service.
164+
- Android will deprioritize your high priority FCM notifications if you fail to show an incoming call ui when receiving them.
165+
- You can avoid getting flooded with sticky foreground service notifications by not defining a Foreground Service for CallKeep, and instead managing this on your own.
166+
150167
## Methods
151168
152169
### setAvailable

0 commit comments

Comments
 (0)