Reputation: 456
I would like to know if there is any way for an android APP to detect how much time does another person (not the device owner) takes to pick up a call. In other words, to measure the time between I dial a number and the other person picks it up. I want to create a chart like: John takes an average of 5 seconds to pick up a call, Jane an average of 8 seconds and so on.
Thanks!
Upvotes: 4
Views: 1547
Reputation: 1084
There may be a way to do it using MediaRecorder, but I've read elsewhere that whether it works depends on the phone. This example records to a file, but you may be able to redirect to a stream and process the audio within your app.
There are other issues to keep in mind, though. Quoting a Lifehacker article:
[W]hen you're dealing with phone calls that aren't via VoIP, you run dangerously close to wiretapping laws, which can get complicated.
If you have the resources, it may be easier to redirect the call through VOIP and record from the VOIP server.
Edit: try this link out. It uses the TelephonyManager
to check for the call state change from "ringing" to "off hook".
Upvotes: 0
Reputation: 523
Create a receiver for callstate, it will recieve every the phone is ringing, idle and in the call. I would get the system time when it starts ringing, and compare against it when the phone answers.
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
//Phone ringing
callTime = System.currentTimeMillis();
}else if(state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK){
//Call answered
answeredTime = System.currentTimeMillis();
timeTaken = answeredTime - callTime;
}else if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)){
//Call rejected
}
}
This should be a start
Upvotes: 3