I have implemented the Twilio in my app and have made it so that web to web calls can be made and also web to phone calls. The only thing is that if I call Voice.call() with my user's phone number, it'll call him but the call will not open my activity on his device. The phone call UI will be the default decide's UI for incoming calls. If I, on the other hand, use the user's defined identity on his device, it'll go nicely via my activity.
Any ideas on how I can make the web to phone call using a phone number and redirect the call via my activity?
I have been unable to find any documentation in this regard.
Cheers!
Twilio developer evangelist here.
It's not the job of the Twilio SDK to intercept phone calls made directly to the device. However, since Android is flexible enough to replace the default phone application, you can do this yourself.
I am not an Android developer however, but a quick search around lead me to this tutorial on using a BroadcastReceiver to run your own code when an incoming phone call occurs. This StackOverflow answer might help you get started too.
Hope that helps.
Related
I am testing an app which has a registration flow and I want to test if incoming calls, sms, alarms or other notifications during this flow will create problems. I am using Espresso for UI automation.
I am new at this and have searched quite a bit but don't seem to find a one shot solution to simulate these, I found telnet for calls but I am using a physical device and did not find anything for others.
If there is a framework for simulating these, please help.
Thank you.
If you are testing more than one application, as it seems from your questions where you mention calls, sms, etc. which are assumed to be handled by other applications, you should use UiAutomator instead of Espresso.
You can find more information in Testing UI for Multiple Apps
In case you want to generate those tests automatically you can take a look at culebra.dtmilano.com.
So, as this is still unanswered and may help someone in future.
There is NO framework currently which can do these on a physical device, you can execute shell commands programatically on an emulator for calls etc.
For me, I used a 3rd party app like automate on a different device and sent sms from my app to it and it inturn called me back, you can add most of the functionality required by this. If you dont want sms charges, you can use discover bluetooth and trigger calls when you see a particular device. Add relevant permissions to use these in your app.
Hey does anyone know if it's possible to intercept incoming calls via an app for both IOS and Android (no jailbreak) then based on certain criteria the phone takes action?
Have already read a few posts saying it's not possible however they are quite old, anyone know of anything new?
Thanks!
The short answer:
On Android: You can do this, but this may require special treatment for different vendors and/or OS versions. It won't be simple to support all (or at least most) devices, but with a lot of manual trial and error, it can be done.
On iOS: It's not possible locally, as Apple sees it as an invasion to the user's privacy.
The (slightly) longer explanation:
What is possible, for both iOS and Android, but will probably require a lot more work and external support than you originally planned, is to divert the calls via a server. This way, when someone calls you, the call is "stolen" by the server (which the user has to manually allow when installing the app) and the call is received on your device as a VOIP call, allowing the app (on the server side) full control over the call (which ones are actually received on the device, what's played, how long, recording, etc). You can see this app for an example of how it works: https://yallo.com/.
I hope this helps. Good Luck.
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.
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.
I am developing an android application. What i want is to call a method present in that android application remotely from a desktop like from a "servlet" or an application.
How can this be done?? For example i want to call a method which i have already written in the app which calls a particular number. How can i invoke this method remotely?? please help.
PS - It is kind of urgent.
It will be hard to communicate from your desktop to your handheld. But you can poll a server from your handheld.
Write an app that every n seconds (the frequency you require) polls e.g. a web page on your server. When the web site's content is "noop", the app does nothing and keeps on polling. If the web site's content is "doit", the app dials the number you want.
So, when you change the content of this web page either manually or programmatically you can "remote-control" your hand held.
This is just an example, it must not be HTTP, neither NOOP and DOIT, just anything you like. Let the server return the phone number which you want dialled for instance.
Well, sounds like you want your app to be waiting for push notifications. I think this question is exactly what you need to look at.