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.
Related
I'm looking for a way to show the default "incoming call screen" to the user.
The user should be able to interact it (i.e. answer/deny) and my application should receive this chosen action.
Although I can design my own "incoming call screen" for sure (kind of faking the default one), but is there any way to ask Android (on a physical device) to display the default screen (I would populate the phone number / name to display).
I don't want to create this screen from scratch, as it won't be exact with the system default, and it would take quite some time for me.
(Motivation: I'm customizing an Android phone, it will show an incoming call screen when the call is actually coming into my other phone - two phones will negotiate the notification/actions via some common interface like Bluetooth or Wifi).
ps: rooting is available, so I have literally no limitation.
This question already has answers here:
Android dialer application
(4 answers)
Closed 5 years ago.
Why I think it's not a duplicate:
I need to replace in-call screen, for both incoming and outgoing calls.
My requirements:
I need to create an Android app that will intercept both incoming and outgoing calls;
I need to display my own UI for the in-call screen.
Use case:
Idea is to create a very simplified android experience for elderly users;
They will be given a tablet with application in a full kiosk mode that will then allow them to receive and call only predefined whitelist of
numbers;
They will get video calls, and etc;
My constraints:
It needs to be stable solution;
I don't need to handle many types of phone, most probably one make will be choosen and ordered in bulk;
It needs to work on recent android;
So is intercepting incoming and outgoing calls possible in android? I want to create my own in-call screen that will used instead of system one.
What I can do to the phone:
I don't (right now) control make of the phone
I can get device admin permissions
I don't want to root the phone or install custom ROM (right now)
Right now only solution I can think of is:
Obtain root access to the phone;
Replace dialer app with our own application;
This might be not possible as I'd need to integrate my dialer/in-call app with this specific system, and they could be intimately tied.
Questions
Is overriding in-call UI feasible in recent android systems?
If so, how it is possible;
The only application that is really able to trigger outgoing calls is the ROM Dialer application that comes with your Android OS. There are a couple of other apps out there, but they only trigger an intent which invokes the native dialer.
What does this mean for you?
Outgoing calls: You can write an application that checks if a number is in the whitelist for example, and which provides a simple, well-defined UI for elderly people. However, this application will then forward the call to the native dialer app. This is not a problem for what you want to achieve in general.
Incoming calls: You simply cannot replace the incoming call screen with your custom implementation. And there is no way of catching a call and forwarding it to your own app instead of the ROM dialer. This is for security reasons.
I tried to do something similar for a research project, where I wanted to provide a custom dialer application for patients suffering from Parkinson's disease. Unfortunately you were right with your guess that what you would like to achieve is only possible if you have root access to the phone.
I created a background service on android and I have two buttons which appear on the top of the screen all the time. I want to use these two buttons like scroll down and scroll up. But these two buttons should work on any kind of applications like Instagram, Facebook, Twitter and so. So, it means it should work in all applications that use scrolling.
I search a week on internet but I could not find any solutions.
This is not possible, sorry. Something like this would require your Service to have access to the Views of the applications and this would be a huge security breach, because you could read values from them and so on.
You could achieve this with a custom button code broadcast (so basically your buttons would act as physical buttons on the device) but this would most probably require you to have system-level permissions and some level of cooperation with the OEMs.
Android Activity class has a method called dispatchKeyEvent(), which could let you simulate the key input (with some limitations) but this is not present in the Service class.
Sadly this is not something you can do in Android. Typically you should not be able to touch views with a background service, the point of a background service is that you do some work in it (for example upload files to your web server or get some data). You CAN send a signal from a service once you're finished doing work to tell an app that something needs to happen, however the app needs to be specifically coded to respond to this broadcasted event.
If you wanted to do this with an app that you have developed, that can be achieved by using the onReceive method of say a BroadcastReceiver, however you cannot specifically define the behaviour of other apps as this would represent a security breach in Android.
I want to know if its possible to create an app that activates in the background when the user gets a phone call ? and if it is possible I'd like to know where I can find more information about how the app can interact with the phone call.
For example, is it possible to turn off / on the mic during a call or intercept it, add sounds in the background etc.
You could use "Broadcast Receiver" available in the API Android.
Here tutorials about those (specific to your very question):
http://androidexample.com/Incomming_Phone_Call_Broadcast_Receiver__-_Android_Example/index.php?view=article_discription&aid=61&aaid=86
And another :
http://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html#tutorial_receiver
I have a requirement where I would want to initiate and manage GSM calls (Like the ones we make via Phone)
I will be connecting to a GSM Module/DTMF Module (context: robotics) via this method and would be sending instructions via DTMF tones.
I don't want to open up the phone dialer via an Intent with tel: data, would rather want to manage the telephony myself.
First thought that the system might not allow a third-party app, without a signature matching system's signature, to do telephony stuff, but then I wondered how some of the apps available in the market are doing it. (I'll attach links as soon as I find suitable ones)
EDIT: The apps that I had seen, were launchers and call manager apps, and once installed, had replaced my default phone apps (and thus were making calls instead of the default phone app doing it)
EDIT: I have found this question asking something similar, and also has an answer: Android Dialer application. I'll try this out and post back if I get any success.
Any pointers will be greatly appreciated.