Enable voice messages
You control whether users can record and share voice messages in conversations. This guide explains how to enable voice messages when you're building with one of the mobile SDKs.
To enable voice messages when using either the React Native or the Flutter SDK, first enable voice messages on your TalkJS dashboard, and then adjust permissions for your app.
Enable voice messages for your chat by selecting the 'Allow recording voice messages' checkbox in the Chat UI page of your TalkJS dashboard.
Add the Microphone/Record Audio permission to your app. How to add this permission to your app depends on the platform:
Add the following to your AndroidManifest.xml
file:
1<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />2<uses-permission android:name="android.permission.RECORD_AUDIO" />
Add the following to your info.plist
:
1<key>NSMicrophoneUsageDescription</key>2<string>Your message to user when the microphone is accessed for the first time</string>
If you're using Flutter, update your Podfile
, as shown in the following:
1post_install do |installer|2 installer.pods_project.targets.each do |target|3 flutter_additional_ios_build_settings(target)45 target.build_configurations.each do |config|6 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [7 '$(inherited)',8 'PERMISSION_MICROPHONE=1',9 ]10 end11 end12end
Users can now record and send voice messages in conversations.