Create an incoming call screen on Android - android

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.

Related

Google home to send card to the Google Home app

I made a small Google Home App and my service returns a response with a SimpleMessage + Card.
It works perfectly when running the app in the console.actions.google.com simulator. I get the card all good.
But when I test talking to the Google Home, it only sends the text, no trace of the Cards anywhere.
However If i talk to the Google home app on my phone, it does send the card correctly.
Is there something to enable to be able to receive cards sent by Google Home? Is it possible at all?
There is no way to make cards that were sent while the user is talking via Google Home visible, but there are several techniques that you, as a developer, can use if cards are necessary.
First of all - good design suggests that cards should be use to supplement the conversation, not be the focus of the conversation. Make sure the voice conversation itself is important and use the visual elements only when necessary. If your action is overly visual - it may be better suited as a mobile or web app, rather than an Action.
If your device requires a screen, then you can set this in the Action Console when you configure your question. This will, however, prevent it from being used on a Google Home device.
If you don't want to go this route, and want to allow it to be used on a smart speaker, but still take advantage of a screen where it is available, you have a few options.
First is that you can just send the cards. As you've discovered, they won't show up, but they won't cause any problems.
If you want to act slightly differently if a screen is available, you can check for the surface capabilities that the user's Assistant is capable of at that moment. If you're using the node.js library, you can have a command such as
let hasScreen = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)
to determine if a screen is available and take action based on the variable hasScreen. If you're using JSON, you need to check the array at surface.capabilities or data.google.surface.capabilities to see if "actions.capability.SCREEN_OUTPUT" is one of the available surfaces.
If not, and you get to a point in the conversation where you feel you need to send a visual result, you can also request to continue the conversation on a device that does support screen output.
First, you'll need to make sure that they have a screen available. You'll do this with the node.js library with something like
const screenAvailable = app.hasAvailableSurfaceCapabilities(app.SurfaceCapabilities.SCREEN_OUTPUT);
or by checking the availableSurfaces.capabilities or data.google.availableSurfaces.capabilities parameters in JSON.
If one is available, you can request to continue the conversation there with something like
app.askForNewSurface(context, notif, [app.SurfaceCapabilities.SCREEN_OUTPUT]);
where context is the message that will be said on the Google Home, and notif is the notification that will appear on their mobile device (for example) to let them continue the conversation. If using JSON, you'll need to use a actions.intent.NEW_SURFACE next intent.
Either way, the user will get a notification on their mobile device. Selecting the notification will start up the Assistant on that device and your Action will be called again with parameters that let you check if they are on the new surface. If so - you can send the card.

Can we automate "Call Receiving" feature in android?

I'm trying to automate calling features in android using robot framework + appiumLibrary.
What I've done so far?
I am able to dial a number using these steps :
Step 1.
Open Application http://localhost:4723/wd/hub platformName=Android platformVersion=5.0.1 deviceName=4a119f6b appPackage=com.android.contacts appActivity=com.android.contacts.DialtactsContactsEntryActivity
Step 2. AppiumLibrary.Click Element name=Keypad
After this I clicked on each number one by one and then clicked on dial button.
Where am I stuck?
In similar fashion I am trying to automate Call receiving feature. I'm dialing from some other phone on connected device and while phone is ringing I'm trying to capture screenshot of xml using uiautomatorviewer.
It is not capturing it.
Is it the right approach?? Is there any other way to automate this functionality?
This depends on your screen mode when you receive it:
If the screen is asleep, i.e., when a call is received it opens the activity to deal with the call, then you can detect what is the package on the screen and match it with the package of the call activity.
If the screen is awake, i.e., when a call is received you see like a small pop up on the top of the screen with the "Answer/Reject" options, then UiAutomatorViewer can't detect them. I don't know if Appium can detect it or not, but I suppose it can't (UiAutomator can't for instance, it can only detect what UiAutomatorViewer detects).
In summary, if a new app is opened, you can detect it is the call app. Otherwise, the "popup" isn't detectable.

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.

Fake Call and message

Can anyone help me how to create a fake call.
as same mobile I want to create a fake name or number and fix timing : Example
5sec.(here i am using the toggle button enable disable fake call)
You cannot create fake calls. You could pretend that it is a call by re-creating the look of dialing screen in your application and show it when you need to fake the call, but you cannot fool (perhaps it might be doable on rooted devices, but I assume you target regular devices) the system and make system dialer (or replacement) to think there's a call while there's not.

Use default incoming call screen fro making fake call

Is there a way to use default incoming call screen with its functionality (answer and reject) from inside my application.
I want to make fake call from inside my application and i don't want to create custom incoming screen but use default incoming call screen on device because different devices have different incoming screens.
No, this can't be done using the standard SDK. First, the call screen activity can only be launched by the system. Second, vendor-specific skins of Android often replace the default phone app with a custom one, so it's unlikely you'd be able to do this on all devices with just a single piece of code even if it were possible.
Your best bet would be to try to recreate the incoming call screen for the most popular devices and detect which device the user is running, which I know isn't what you wanted to hear. Sorry.

Categories

Resources