I am developing a project in which I want to pick up the incoming call automatically after the certain interval, play an audio file and record the conversation for minute. As I have been Successful in implementing Callreciever Function in which I can able to detect the current call state of my phone.
CallReciever.Java
package com.example.deepdepindersingh.activevoice;
import android.content.Context;
import android.widget.Toast;
import java.util.Date;
/**
* Created by Deep Depinder Singh on 8/21/2016.
*/
public class CallReceiver extends PhonecallReceiver {
@Override
// call comming
protected void onIncomingCallStarted(Context ctx, String number, Date start) {
Toast.makeText(ctx, number , Toast.LENGTH_SHORT).show();
}
@Override
//Call picked by me
protected void onOutgoingCallStarted(Context ctx, String number, Date start) {
Toast.makeText(ctx, number , Toast.LENGTH_SHORT).show();
}
@Override
// Call ended by me
protected void onIncomingCallEnded(Context ctx, String number, Date start, Date end) {
Toast.makeText(ctx, number , Toast.LENGTH_SHORT).show();
}
@Override
protected void onOutgoingCallEnded(Context ctx, String number, Date start, Date end) {
}
@Override
protected void onMissedCall(Context ctx, String number, Date start) {
Toast.makeText(ctx, number , Toast.LENGTH_SHORT).show();
}
}
It is actually autoanswering and yes there is way to pick up call automatically in android ,for that you must use these code available at autoanswer . I think it will help you , it is a complete tutorial for your task.