Bypass dialer to make a call with pre-defined phone number - android

I need to figure out how to harness the power of the CALL_PRIVILEGED Permission in my app.
The basic layout is that when I activate the code it just goes to the Dialer with the number preloaded.
How do i bypass the dialer and just make the call?

You want your app to make a direct call?
Take a look at Intent.ACTION_CALL (ACTION_DAIL will show the number before calling).
EDIT: ACTION_CALL won't call emergency numbers.
Actually this changed from version to version of Android, so it could be that it works with 2.1 but not with 4.0.
Wolfen

Related

Can I suppress Send SMS option when calling ACTION_DIAL intent

My team is developing an Android app that includes the ability to call and talk to customer support. We are calling an Intent with ACTION_DIAL, which brings up the dialer with the phone number pre-populated, as expected. In the device emulator, we also see links to Create a new Contact and Add to a Contact, which are fine, but we want to suppress the Send SMS link, since there is no way for us to read messages sent to that number. Ideally, I'd like to be able to pass a parameter or change a setting that disables SMS messaging for that one invocation, but I'm open to other solutions. Searches that I've done haven't turned up anything.
Thanks in advance,
Dan
No. There's no way of knowing what dialer is being launched for action dial- OEMs all have the option of using their own, or the user can even download one of their own. There's no way of knowing what options those dialers support, and definitely no way of configuring them. Even if there was, a dialer app could ignore the configuration. You may want to use ACTION_CALL instead, which requires additional permissions but will directly call without bringing up a prefilled dialer.

Custom dialler for Internet Calls (Android)

I'm trying to get an idea of what's possible and what isn't in terms of using a custom dialler app for internet calls.
The idea is that the standard Android dialler be used when no internet connection is available, but use a custom-written VOIP dialler / caller app whenever an internet connection is available.
I see that in the Android call settings you can set it to use Internet calling whenever a connection is available. How does this work? Does this simply tell the native dialler app to use internet calling, or is there actually a specific Intent or something that gets fired when an internet call is made so that I can open my custom SIP app?
And also, is the 'standard phone app' icon always linked to the standard phone app, or can you override this phone icon to open your custom VOIP app when a connection is present?
So basically, is there a way to seamlessly and automatically switch between the standard dialler and the custom SIP dialler based on whether or not the phone is connected to the internet?
If not, is this something that could be done by customizing Android?
Thanks,
There are four possible ways of doing what you want that I know of:
1. Replace the Android Dialer
This is hard and a lot of work. The Android Dialer (last time I checked anyway) WAS the telephony stack in Android. So to replace it you have to replace the complete telephony stack (including any public API) i.e. handle all cellular (and now sip) calls in and out of the device. Also the only way to replace it is to root the device as it can't be replaced normally.
2. Provide your own Dialer that is separate to the main dialer.
This has it's advantages that you will never get into "trouble" with anything else.
3. Hook into the outbound call API (ACTION_NEW_OUTGOING_CALL)
This is something that is pretty cool and I haven't seen any other OS allow you to do. Basically you can trap when either the normal dialer starts to dial a number (or when another application starts to dial a number as well) and you can either allow it through, modify it or cancel it. Behavior I've seen from sip clients is that they will cancel the call and put up a selection screen prompting where you want to send the call (sip, cellular or something else).
Here is an example of it's use.
The downsides are:
You can be fighting with other applications to which gets first go. There is a 'priority' setup, but all I've seen is everybody wants to be number one.
On some Android devices where the OEM providers that own Dialer, they don't always fire it!!!
4. Detect when the dialer is shown and show your own dialer in front of it.
This works and does allow you to provide a nicer more integrated feel as you can provide call type selection within the dialer, as well as other custom number lookups but that can be a little tricky to do on some devices.
I would suggest 3 to begin with as it's pretty easy to do and you can get something up going pretty fast. In code that I have worked on, we have done 2, 3 and 4 and also looked into 1.

Android phone calls from an application

In android programming, is it possible to make a phone call within a service without showing the 'phone call screen'? Any example would be very helpful. Thanks in advance.
In android programming, is it possible to make a phone call within a service without showing the 'phone call screen'?
That depends on what you consider the "phone call screen" to be.
If you mean the dialer, then, yes, you can use an ACTION_CALL Intent to bypass that, assuming that you hold the CALL_PHONE permission.
If you mean the in-call screen then, no, AFAIK there is no way to avoid that screen. That screen is rather important for the user.

Replace default Screen of android incoming and outgoing calls

I am working on android. when a calls comes in, I want to replace the default android call screen with a new screen that has answer and deny call options. How can I do that? Need some help. Any help appreciated.
Do I have to use a toast message for this?
I do have the incoming and outgoing classes.
As far as my understanding goes it is not possible to replace the call screen with an App that is installed over the Marketplace.
To do this you would at least require root permissions. Maybe you also need to reconfigure the Android Version installed on the phone.

Dial number without prompt

I'm trying to write a function for the Android platform that will allow me to call 911 without any sort of prompt.
I have already added the permission android.permission.CALL_PRIVILEGED. I just need a function that will dial 911 at the press of a button in my options menu.
According to the API, ACTION_CALL will do what you need but not to emergency numbers, while ACTION_DIAL will display a dialer with the dial prompt but allows to call emergency numbers.
I'm afraid there is no way to do what you want, for a good reason - to prevent misdials to emergency services. It's a precautionary measure.

Categories

Resources