From e5e151a40fd0475126fab785ac754195db133700 Mon Sep 17 00:00:00 2001 From: David Prevost Date: Fri, 1 Nov 2024 09:39:52 -0400 Subject: [PATCH] Add style md doc --- .../react-native/docs/android/styles.md | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs-react-native/react-native/docs/android/styles.md b/docs-react-native/react-native/docs/android/styles.md index 95f6bd50..bbd60189 100644 --- a/docs-react-native/react-native/docs/android/styles.md +++ b/docs-react-native/react-native/docs/android/styles.md @@ -149,4 +149,38 @@ song/video playing with album art. # Call -TODO dprevost +Call-style notifications starting from Android 12 display phone call-related notifications with a top ranking in the shade. + +At the root, the style accepts a `person` property, which contains information of the current device user. To see more about +the options available to you, view the [`AndroidPerson`](/react-native/reference/androidperson) documentation. + +The property `callTypeActions` accepts an object with either the desired call type number (incoming, ongoing, screening) or a whole action object with only the `pressAction` object for better customization. When using the call type only, predefined pressAction IDs are provided matching the predefined button name (e.g., `answer`, `decline`, `hangUp`). If desired, we can change those IDs and even provide launch activity flags when defining the `pressAction`. + +It is important to known that the call style must be used with the Foreground service or a `fullScreenIntent`. + +To implement this style, we provide the `AndroidStyle.CALL` to the `style` object: + +```js +import notifee, { AndroidStyle, AndroidImportance, AndroidCallType } from '@notifee/react-native'; + +notifee.displayNotification({ + title: 'Incoming call', + body: 'Sarah is calling', + android: { + channelId, + asForegroundService: true, // needs foreground Service or a fullScreenIntent. + category: AndroidCategory.CALL, + importance: AndroidImportance.HIGH, + style: { + type: AndroidStyle.CALL, + person: { + name: 'Sarah Lane', + icon: 'https://my-cdn.com/avatars/123.png', + }, + callTypeActions: { + callType: AndroidCallType.INCOMING, + }, + }, + }, +}); +```