It is very simple, it is completely event based. Let me give you the logic for this.
- Create a BroadcastReceviver that will check incoming and outgoing calls.
- Create a method that will record voice for both events.
- Whenever BroadcastReceiver starts, just call this init method.
- Done.
eg.
Declare a receiver in AndroidManifest
<receiver android:name=".CallRecoderBroadcast">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
Grant read permission to the phone in AndroidManifest
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
SD- ,
http://www.devlper.com/2010/12/android-audio-recording-part-1/
http://www.devlper.com/2010/12/android-audio-recording-part-2/