How can I detect when a call is answered? [duplicate] - android

Once ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the Android dialer app changes the green Android icon to the person's photo exactly when they pick up.
UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils:
/**
* Kick off an intent to initiate a call.
*/
public static void initiateCall(Context context, CharSequence
phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
Uri.fromParts("tel", phoneNumber.toString(), null));
context.startActivity(intent); }
I guess my answer is in the activity listening for Intent.ACTION_CALL_PRIVILEGED. So to rephrase my question: Does anyone know which activity handles Intent.ACTION_CALL_PRIVILEGED?

I don't think there's such API and also there's no API for sending DTMFs due to the same reason that you can't tell when the call is being connected.

It does not necessarily needs to be possible to capture this as an outside app. The green android icon is a part of the application that controls the call, so it does not need a broadcast to change the icon.

As far as android's telephony manager is concerned u cannot detect programmatically whether the call has been answered or not. This is to say that u do not have the option to know when the user picked the phone at other end.
Android has got 3 states of telephony manager and none of them are capable of detecting whether the call was actually answerd or not(IN CASE OF OUTGOING CALLS)

The only way you may be able to do this is by parsing the Logcat logs, no PhoneStateListener event is available for that.
Some are asking for it here: https://code.google.com/p/android/issues/detail?id=14266
Anyway, in versions above Android 4.2 as Logcat is "sandboxed" it may be impossible...

Related

how to make custom incoming call screen in Android in android kitkat

I tried many ways , but didn't work on kitkat or lollipop
I need broadcast receiver with code that can answer the call by a button , please
Sadly, you can't answer the call. This is a system permission that you can't acquire.
It is system permission and you shouldn't do it, but I found nice solution to this. You can use Intent.ACTION_MEDIA_BUTTON and send it once to answer a call and send it twice to reject it.
Android emulate/send ACTION_MEDIA_BUTTON intent

Programmatic auto attendant on an Android device

Is it possible to create an Android application that automatically attend incoming calls to an Android phone? If so, which APIs may be used to achieve this (a piece of code snippet highly appreciable)?
If the programmatic auto attendant feature not possible, why the Android OS imposes this restriction?
Is iOS behaves as same as Android in this scenario, please explain.
While googling I found something that can be useful. I haven't tried yet still I think this will help have a look at Call Control in Android
You can listen incomming call intent by implementing broadcast receiver Intent.CALL_STATE_CHANGED to listen for incoming call, but answering incomming call automatically seems not feasible.coz android application dont have access to incomming call audio stream.

What is the status of an outgoing call [duplicate]

Once ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the Android dialer app changes the green Android icon to the person's photo exactly when they pick up.
UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils:
/**
* Kick off an intent to initiate a call.
*/
public static void initiateCall(Context context, CharSequence
phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
Uri.fromParts("tel", phoneNumber.toString(), null));
context.startActivity(intent); }
I guess my answer is in the activity listening for Intent.ACTION_CALL_PRIVILEGED. So to rephrase my question: Does anyone know which activity handles Intent.ACTION_CALL_PRIVILEGED?
I don't think there's such API and also there's no API for sending DTMFs due to the same reason that you can't tell when the call is being connected.
It does not necessarily needs to be possible to capture this as an outside app. The green android icon is a part of the application that controls the call, so it does not need a broadcast to change the icon.
As far as android's telephony manager is concerned u cannot detect programmatically whether the call has been answered or not. This is to say that u do not have the option to know when the user picked the phone at other end.
Android has got 3 states of telephony manager and none of them are capable of detecting whether the call was actually answerd or not(IN CASE OF OUTGOING CALLS)
The only way you may be able to do this is by parsing the Logcat logs, no PhoneStateListener event is available for that.
Some are asking for it here: https://code.google.com/p/android/issues/detail?id=14266
Anyway, in versions above Android 4.2 as Logcat is "sandboxed" it may be impossible...

How to launch the incoming call interface?

I'm devlopping a SIP application and whant to launch the normal incoming call interface when having an incoming call from a SIP client. Is that possible ?
Thank you very much.
I am sorry, but it looks like there is nothing as standard incoming call interface in Android (at least not until API level 10).
The screen that you see on incoming call is part of the native PhoneApp. More specifically, it is handled by the class InCallScreen.java from the dialer source code. That Activity has no Intent filters defined, so definitely it is not intended for external usage.
However, some applications may mimic native screens (or copy complete layout, not sure if license allows that), so it looks like it is from native, although in fact it is not.
I checked the source of default phone app, and I figured the only way to get this done is draw a layout exactly like the default incoming call interface -_-||
If you have the solution , please tell me , thank you so much !

Detect if an outgoing call has been answered

Once ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the Android dialer app changes the green Android icon to the person's photo exactly when they pick up.
UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils:
/**
* Kick off an intent to initiate a call.
*/
public static void initiateCall(Context context, CharSequence
phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
Uri.fromParts("tel", phoneNumber.toString(), null));
context.startActivity(intent); }
I guess my answer is in the activity listening for Intent.ACTION_CALL_PRIVILEGED. So to rephrase my question: Does anyone know which activity handles Intent.ACTION_CALL_PRIVILEGED?
I don't think there's such API and also there's no API for sending DTMFs due to the same reason that you can't tell when the call is being connected.
It does not necessarily needs to be possible to capture this as an outside app. The green android icon is a part of the application that controls the call, so it does not need a broadcast to change the icon.
As far as android's telephony manager is concerned u cannot detect programmatically whether the call has been answered or not. This is to say that u do not have the option to know when the user picked the phone at other end.
Android has got 3 states of telephony manager and none of them are capable of detecting whether the call was actually answerd or not(IN CASE OF OUTGOING CALLS)
The only way you may be able to do this is by parsing the Logcat logs, no PhoneStateListener event is available for that.
Some are asking for it here: https://code.google.com/p/android/issues/detail?id=14266
Anyway, in versions above Android 4.2 as Logcat is "sandboxed" it may be impossible...

Categories

Resources