RecordingNotificationManager Android only
The RecordingNotificationManager provides system integration with Recorder.
It can send events about pausing and resuming to your application.
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.
| Parameter | Type | Description |
|---|---|---|
info | RecordingNotificationInfo | Initial notification metadata |
Returns Promise<void>.
For more details, go to android developer page. Resource name is a path to resource plased in res/drawable folder. It has to be either .png file or .xml file, name is indicated without file extenstion. (photo.png -> photo).
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
Add an event listener for notification actions.
| Parameter | Type | Description |
|---|---|---|
eventName | RecordingNotificationEvent | The event to listen for |
callback | (`RecordingNotificationEvent) => void | Callback 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; //
}
RecordingNotificationEvent
Type definitions
interface RecordingNotificationEvent {
recordingNotificationPause: EventEmptyType;
recordingNotificationResume: EventEmptyType;
}