What is the status of an outgoing call [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

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.

How can I detect when a call is answered? [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 !

android Outbound caller id - on/off

I wan to hide/show my caller id from my activity programmatically. I tried to find it in the android documentation but without the luck. Maybe you have any ideas?
I posted a question asking this on the Android Google group and got absolutely no answers at all. I've also seen a couple of other question on SO which also had no answers (or none that work).
I came to the conclusion that it simply isn't possible. My reasoning is this...
If I go to Settings -> Call -> Additional settings, I see an AlertDialog which has a HeaderTitle of 'Call settings' and I see a circular progress indicator and a message saying 'Reading settings...'.
It occurs to me that my phone is, at that point, accessing my phone/network provider. The resulting 'chooser' dialog gives me options for 'Network default', 'Hide number' and 'Show number' and when I make a selection (or even if I just 'Cancel' the dialog), I get another AlertDialog with circular progress indicator with the message 'Updating settings...'.
In short, it seems the Caller ID setting is not entirely 'local' to the phone settings and relies on interaction with the provider and, for whatever reason, as a result of this the Android APIs don't allow this to be manipulated programatically.
I'm not sure if this is something on the 'To Do' list for future versions of Android or if there are legal/security implications in allowing it to be done or some other reason. Whatever the case may be, I haven't found anybody so far who is able to explain why there isn't a method for TelephonyManager (for example) to simply switch this.
EDIT: No luck on getting the Additional Settings AlertDialog with the standard APIs either.
The reason I say that is that it is possible to pull up various parts of the device's 'Settings', e.g., in one of my apps I use android.provider.Settings.ACTION_WIRELESS_SETTINGS in the constructor of an Intent passed to startActivity(). This brings up the Settings page for enabling/disabling wi-fi, mobile internet and bluetooth.
android.provider.Settings has other similar ACTIONs for other Settings pages but there isn't even one for 'Call' never mind Call -> Additional Settings and nothing for the AlertDialog to allow you to choose to Hide/Show the outgoing Caller ID.
If this can be done then it would have to be an undocumented API unless I completely missed it (I spent a long time looking). I suspect examining the Android source-code may be the only way to find an answer and I haven't attempted that yet.
I have managed to get Additional call settings dialog. Explanation below:
Although it looks like it is part of the Settings, in fact it is part of the Native PhoneApp. If you take a look at the AndroidManifest.xml of the PhoneApp you will see that Activity GsmUmtsAdditionalCallOptions has defined IntentFilter for the android.intent.action.MAIN.
So, the code that I checked to work correctly on several phones:
Intent additionalCallSettingsIntent = new Intent("android.intent.action.MAIN");
ComponentName distantActivity = new ComponentName("com.android.phone", "com.android.phone.GsmUmtsAdditionalCallOptions");
additionalCallSettingsIntent.setComponent(distantActivity);
startActivity(additionalCallSettingsIntent);
If the #31# trick works for your needs for a single call then you could add a broadcast receiver that listens for the outgoing call notification and modifies the number to include #31# at the start before it gets dialled. Android allows the number to be changed on the way through like that.
Only works if your default is to enable caller ID and your network support #31# and you want to toggle it off using a widget, say.
The Caller ID is network specific not something that the phone controls. In fact in certain mobile network configurations the phone doesn't even 'know' its own phone number.
Some networks support sending an activate/deactivate caller ID network command. In GSM this is normally #31#. It can be permanent or on a per call basis.
Permanent requests the network to hide the caller ID for all calls.
Per call requests the network to hide the caller ID only for that call. The latter is achieved by prefixing the number being called by #31#, so for example calling #31#85432786426 would call 85432786426 hiding the caller.
Some networks support both, some only support one of them, and some do not enable it. Try your luck and try prefixing the dialed number with #31# and see if it works.
http://www.gsm-security.net/faq/gsm-caller-id-clip-clir.shtml
If you want a shortcut to the additional call settings, you can use App Cut and select GSM settings. It will place a shortcut on your home screen.

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