5
votes

I'm writing a small call recording library for my rooted phone.
I saw in some application that recording is done through ALSA or CAF on rooted phones.
I couldn't find any example / tutorial on how to use ALSA or CAF for call recording (or even for audio recording for that matter).
I saw tinyAlsa lib project, but I couldn't figure how to use it in an android app. Can someone please show me some tutorial or code example on how to integrate ALSA or CAF in an Android application?

Update I managed to wrap tinyAlsa with JNI calls. However, calls like mixer_open(0) returns null pointers, and calls like pcm_open(...) returns a pointer but subsequent call to is_pcm_ready(pcm) always returns false.
Am I doing something wrong? Am I missing something?

1
"recording is done through ALSA or CAF on rooted phones". For what purpose? Why not use Android's regular audio recording APIs (MediaRecorder or AudioRecord)? - Michael
Both for academic purposes (gain more knowledge) and for practical ones - using standard api call recording is poor on my device (nexus 5), which apparently doesn't support standard api - Oren
I would like to add that I looking for a way to record direct system audio, whether it is ALSA / CAF or anything else is less important - Oren

1 Answers

0
votes
  • Here's how to build ALSA lib using the Android's toolchain.
  • and here you can find another repo mentioning ALSA for android

I suggest you to read this post on order to understand what are your choices and the current platform situation.

EDIT after comments:

I think that you need to implement your solution with tinyalsa assuming by you are using the base ALSA implementation. If the tiny version is missing something then you may need to ask the author (but it sounds strange to me, because you are doing basic operations). After reading this post, we can get some clues about why root is needed (accessing protected mount points).

Keep us updated with your progress, it's an interesting topic!