From 496521ad8b2f5d8faa1dc24123358e8ac783d175 Mon Sep 17 00:00:00 2001 From: Aleksandar Apostolov Date: Wed, 21 Feb 2024 17:01:23 +0100 Subject: [PATCH] Update docs on Intent filters and incoming/outgoing call requirements (#1016) --- .../docs/Android/01-basics/03-quickstart.mdx | 52 +++++++++++++++++++ .../02-push-notifications/02-setup.mdx | 23 +++++--- 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/docusaurus/docs/Android/01-basics/03-quickstart.mdx b/docusaurus/docs/Android/01-basics/03-quickstart.mdx index ef58d92998..974e5ad5a1 100644 --- a/docusaurus/docs/Android/01-basics/03-quickstart.mdx +++ b/docusaurus/docs/Android/01-basics/03-quickstart.mdx @@ -31,6 +31,58 @@ The call type controls the permissions and which features are enabled. The second argument is the call id and is optional. It's convenient to specify an ID if the call is associated with an object in your database. As an example if you're building a ride sharing app like Uber, you could use the ride id as the call id to easily align with your internal systems. +#### Incoming / outgoing calls +If you intend to support incoming and outgoing calls the SDK must know which activities to call in the notification `PendingIntent`. +In order to be able to accept and send incoming calls via the default notification handler provided by the SDK, you need to handle the intent actions in your manifest. + +The SDK defines the following actions: +```kotlin +ACTION_NOTIFICATION = "io.getstream.video.android.action.NOTIFICATION" +ACTION_LIVE_CALL = "io.getstream.video.android.action.LIVE_CALL" +ACTION_INCOMING_CALL = "io.getstream.video.android.action.INCOMING_CALL" +ACTION_OUTGOING_CALL = "io.getstream.video.android.action.OUTGOING_CALL" +ACTION_ACCEPT_CALL = "io.getstream.video.android.action.ACCEPT_CALL" +ACTION_REJECT_CALL = "io.getstream.video.android.action.REJECT_CALL" +ACTION_LEAVE_CALL = "io.getstream.video.android.action.LEAVE_CALL" +ACTION_ONGOING_CALL = "io.getstream.video.android.action.ONGOING_CALL" +``` + +If you do not support incoming and outgoing calls, you can skip the `` declarations. + +In order to be able to fully utilize the incoming / outgoing feature the SDK needs to know which activity these actions resolve to in order to construct the `PendingIntent`s. +You have to provide this information into your manifest. + +The `ACTION_REJECT_CALL` and `ACTION_LEAVE_CALL` are handled by default by the SDK and you do not have to do anything about them. +The `ACTION_ONGOING_CALL` does not mandate an `` with the consequence that omitting this will result in reduced functionality where the user will not be returned to your app if the notification is clicked. + +All the other actions must be declared in your manifest, otherwise the internal `CallService` will fail to create the required notification for a foreground service and thus not start, resulting in an exception. + +```xml + + + + + + + + + + + + + +``` +:::info +You can handle multiple `IntentFilter` within a single `activity` if you prefer or have separate activity for each action. +::: + +For more details on notification customization see our [Push Notification Guide](../06-advanced/02-push-notifications/01-overview.mdx). + ### Rendering video The call's state is available in [`call.state`](../03-guides/03-call-and-participant-state.mdx) and you'll often work with `call.state.participants`. diff --git a/docusaurus/docs/Android/06-advanced/02-push-notifications/02-setup.mdx b/docusaurus/docs/Android/06-advanced/02-push-notifications/02-setup.mdx index 41259463d5..be1e3051ae 100644 --- a/docusaurus/docs/Android/06-advanced/02-push-notifications/02-setup.mdx +++ b/docusaurus/docs/Android/06-advanced/02-push-notifications/02-setup.mdx @@ -66,28 +66,36 @@ You only need to create the `Activity`/`Activities` will be called when the Push The different actions we provide are: * `io.getstream.video.android.action.INCOMING_CALL`: Action used to process an incoming call. The `activity` that handles this action should show options to accept/reject the call. You can use our [RigningCallContent](../../04-ui-components/04-call/04-ringing-call.mdx) component to build your screen. This screen can be shown when the device is locked, by adding some arguments on the manifest. +* `io.getstream.video.android.action.OUTGOING_CALL`: Action used to process an outgoing call. The `activity` that handles this action should show options to cancel the call. You can use our [RigningCallContent](../../04-ui-components/04-call/04-ringing-call.mdx) component to build your screen. * `io.getstream.video.android.action.ACCEPT_CALL`: Action used to accept an incoming call. The `activity` that handles this action should accept the call and show the call screen. You can use our [CallContent](../../04-ui-components/04-call/03-call-content.mdx) component to build your screen. * `io.getstream.video.android.action.LIVE_CALL`: Action used to go into a live call. The `activity` that handles this action should show the live call screen. You can use our [CallContent](../../04-ui-components/04-call/03-call-content.mdx) component to build your screen. * `io.getstream.video.android.action.ONGOING_CALL`: Action used to get back into already running call. The `activity` that handles this action should show the call screen. You can use our [CallContent](../../04-ui-components/04-call/03-call-content.mdx) component to build your screen. These actions need to be included on the `AndroidManifest` while you declare your activities: -``` xml {4,9-11,15,18-20,24,27-29,33,36-38} +``` xml {4,8-10,13,17-19,23,26-28,31,33-35,39,42-44} + android:showWhenLocked="true"> + + + + + + android:exported="false"> @@ -95,8 +103,7 @@ These actions need to be included on the `AndroidManifest` while you declare you + android:exported="false"> @@ -142,7 +149,7 @@ class MyNotificationHandler(private val context: Context) : NotificationHandler context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } - // Called when a Ringing Call arrives. + // Called when a Ringing Call arrives. (outgoing or incoming) override fun onRingingCall(callId: StreamCallId, callDisplayName: String) { val notification = NotificationCompat.Builder(context, notificationChannelId) ... // Configure your own notification