🪁 React Native Audio notification for Android
⚠️ Currently only available for Android devices
npm install react-native-audio-notification
or
yarn add react-native-audio-notification
import AudioNotification from 'react-native-audio-notification';
// Initialization AudioNotification
const audio = {
title: 'STAY',
description: 'The Kid LAROI / Justin Bieber',
cover:
'http://p2.music.126.net/e5cvcdgeosDKTDrkTfZXnQ==/109951166155165682.jpg',
is_play: true,
is_like: true,
};
const notice = AudioNotification(audio);
// Push Notification
notice.notify();
// Turn off notification
notice.cancel();
// Modify configuration
notice.setAudioConfig(audio);
// Update notification (called when audio data is reset)
notice.update();
// Monitor user events
const action = 'onClickLike' | 'onClickLast' | 'onClickPlay' | 'onClickNext' | 'onClickClose';
notice?.subscribe(action, (event: any) => {
console.log('User manipulated ' + action, event);
});
for more detailed code examples, you can see example/src/App.tsx
See the contributing guide to learn how to contribute to the repository and the development workflow.
If you use the module, you can click Star to encourage us.
MIT
The copyright of the music cover image belongs to the original author. We do not save or modify it, but only for demonstration.