audio_recorder_service 0.0.5 copy "audio_recorder_service: ^0.0.5" to clipboard
audio_recorder_service: ^0.0.5 copied to clipboard

discontinuedreplaced by: audio_recorder_service_flutter

A Flutter Background Service Audio recorder and Notification

Audio Recorder Service #

A Flutter package that provides functionality for recording audio with the ability to pause, resume, and stop the recording. It also includes background notifications to manage the recording state.

Features #

  • Start, pause, resume, and stop audio recording.
  • Background notifications during recording.
  • Supports AAC audio encoding.
  • Works across Android platforms.
  • Handles recording permissions automatically.

Getting Started #

Usage #

  1. Initialize the Recorder final audioRecorderService = AudioRecorderService(); await audioRecorderService.initializeNotifications();
  2. Start Recording await audioRecorderService.startRecording();
  3. Pause Recording await audioRecorderService.pauseRecording();
  4. Resume Recording await audioRecorderService.resumeRecording();
  5. Stop Recording await audioRecorderService.stopRecording();

Android Setup #

To enable background recording, you need to update AndroidManifest.xml and build.gradle.

  1. Modify AndroidManifest.xml Location: android/app/src/main/AndroidManifest.xml

Add Permissions #

Inside <manifest>: <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.INTERNET"/>

Add Receivers #

Inside <application>:

<receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" /> <receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/> </intent-filter> </receiver> <receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver" />

Add Service #

Add this after <activity>:

<service android:name="com.ryanheise.audioservice.AudioService" android:foregroundServiceType="mediaPlayback" android:exported="true" tools:ignore="Instantiatable"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> </intent-filter> </service>

  1. Modify android/app/build.gradle Location: android/app/build.gradle

Ensure the following settings:

compileSdk = 34 minSdk = 23 defaultConfig { multiDexEnabled true // Add this line }

To use this package, add it to your pubspec.yaml:

dependencies:
  audio_recorder_service:
    path: ../audio_recorder_service


2
likes
0
points
6
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter Background Service Audio recorder and Notification

License

unknown (license)

Dependencies

flutter, flutter_background_service, flutter_local_notifications, just_audio, just_audio_background, path_provider, permission_handler, record, wakelock_plus

More

Packages that depend on audio_recorder_service