Closed alti-kr closed 2 years ago
Hi @alti-kr
Have you tried using foreground-services? If you want audio to continue recording when the app is in the background or when the screen locks, you should be using the foreground-services
. A related issue can be referred here.
Hi
I checked and corrected. But that didn't solve the problem.
Result:
7/10 files didn't have the sound
@alti-kr
Can you share your foreground-services implementation and how you are starting when a call is started or accepted? How are you recording the audio?
@kbagchiGWC `In Mahifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<service
android:name=".services.AaaService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="microphone" />
Strat Service
val intent = Intent(context, AaaService::class.java).also { intent -> intent.putExtra(ExtraKey0, true) context.startForegroundService(intent)
In AaaService
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { this.startForeground( id, ServiceUtils.buildForegroundNotification( channelId, channelName, channelDescription, title, content, icon, service, priority ) ) }` NoSound.txt WithSound.txt
In the attached files you can see the logs of both situations.
@kbagchiGWC The problem was localized, if service was started from app, client of twilio has access to microphone on Pixel device and hasn't access to microphone on Samsung device. The main problem is how to run the application without user intervention (Android 12) or access the microphone from the service. I will close the issue, thanks.
There is no sound in the audio file Android 12
App uses com.twilio:voice-android:6.1.1, The app needs to record audio when it's in the background or foreground. For this, a background service is used, the context of which is used to initialize the twilio client. When app in foreground it's all ok. When app in background and service started auido recording, there is no sound in the audio file.
Steps to Reproduce
Code
Expected Behavior
Hear the recorded conversation etc.
Actual Behavior
Silence
Reproduces How Often
99%
Twilio Call SID(s)
SIDs of the conferences:
CF2495712c75b27b884a3eab1fd6a72d94 CF49e987e19a4a93c4355bd709019ba33b CFf464657ab504d7bb6389fdcad704d259
Good RE4b74074969b20f7be7e0c370871accb2
Logs
Versions
compileVersion = 31 minVersion = 21 targetVersion = 31
Voice Android SDK
com.twilio:voice-android:6.1.1
OS Version
Android 12
Device Model
Samsung S20 FE, Android 12, build 1.3.1.6 Pixel 4, Android 12, build 1.3.1.6