Skip to main content
Version: Next

RecordingNotificationManager
Android

The RecordingNotificationManager provides system integration with AudioRecorder on Android. It can send events about pausing and resuming to your application.

iOS

RecordingNotificationManager is not available on iOS. For a recording indicator on the Lock Screen and in the Dynamic Island, use a Live Activity built with expo-widgets.

Example

RecordingNotificationManager.show({
title: 'Recording app',
contentText: 'Recording...',
paused: false,
smallIconResourceName: 'icon_to_display',
pauseIconResourceName: 'pause_icon',
resumeIconResourceName: 'resume_icon',
color: 0xff6200,
});

const pauseEventListener = RecordingNotificationManager.addEventListener('recordingNotificationPause', () => {
console.log('Notification pause action received');
});
const resumeEventListener = RecordingNotificationManager.addEventListener('recordingNotificationResume', () => {
console.log('Notification resume action received');
});

pauseEventListener.remove();
resumeEventListener.remove();
RecordingNotificationManager.hide();

Methods

show

Shows the recording notification with the parameters.

Metadata is saved between calls, so after the initial pass to the show method, you need only call it with elements that are supposed to change.

ParameterTypeDescription
infoRecordingNotificationInfoInitial notification metadata

Returns Promise<void>.

info

For more details, go to android developer page. Resource name is a path to resource placed in res/drawable folder. It has to be either .png file or .xml file, name is indicated without file extension. (photo.png -> photo).

caution

If nothing is displayed, even though your name is correct, try decreasing size of your resource. Notification can look vastly different on different android devices.

hide

Hides the recording notification.

Returns Promise<void>.

isActive

Checks if the notification is displayed.

Returns Promise<boolean>.

addEventListener

Adds an event listener for notification actions.

ParameterTypeDescription
eventNameRecordingNotificationEventNameThe event to listen for
callbackNotificationCallbackCallback function

Returns AudioEventSubscription.

Remarks

RecordingNotificationInfo

Type definitions

interface RecordingNotificationInfo {
title?: string;
contentText?: string;
paused?: boolean; // flag indicating whether to display pauseIcon or resumeIcon
smallIconResourceName?: string;
largeIconResourceName?: string;
pauseIconResourceName?: string;
resumeIconResourceName?: string;
color?: number; //
}

RecordingNotificationEventName

Type definitions

interface EventEmptyType {}

interface RecordingNotificationEvent {
recordingNotificationPause: EventEmptyType;
recordingNotificationResume: EventEmptyType;
}

type RecordingNotificationEventName = keyof RecordingNotificationEvent;

NotificationCallback

Type definitions

type NotificationCallback<Name extends RecordingNotificationEventName> = (
event: RecordingNotificationEvent[Name]
) => void;