Can we automate "Call Receiving" feature in android? - 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.

Related

Create an incoming call screen on 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.

Android App execute code on unknown button click

I am working on an android app to run as a front end on my Parrot Asteroid Smart which runs a modified version of gingerbread as my cars headunit.
At present the unit natively senses the reverse gear signal and displays a "complete action using" dialog which displays one of two camera applications.
I don't have a camera but what I want to do when it senses reverse is to reduce the volume to a set value. I have completed the code to do volume adjustment, however.
I am having an issue determining what button input or trigger the reverse gear is producing. I have already tried some code which logs the onKeyDown event which I have confirmed works when I click the menu or back button but when I trigger the reverse signal there is no log for a keydown.
Although I have a number of years experience in other languages I am new to android app development and java so no suggestion is to ridiculous at this time.
It seems to me like the reverse gear is triggering an Intent since it displays the app chooser dialog. It is probably sending a MediaStore.ACTION_IMAGE_CAPTURE intent or something similar that will require a camera app to complete. If that is the case, then you could modify your app and register to receive those intents and handle them however you'd like.

Android . Activating my application when some string was entered in some other application

I am trying to create a behavior where entering some string in any application will open my application.
I've tried looking around on how to listen for keyboard press or listening for text change, but I couldn't find my required behavior and I don't want to create a custom keyboard for this.
If this is not possible, what will be a good implementation for lunching my application as fast as possible while in the other application?
Answered before the requirement to "don't want custom keyboard"
The only viable way that I can think of is if the user was using a custom keyboard written by you. Custom keyboards can and do act as key-loggers and therefor could detect any key combination, or written word and allow you to execute your code when your conditions are met.
Rerfer to Creating an input method docs
How to open my app as fast as possible from another application?
Press home, launch your app by clicking on the launcher icon
But assuming you mean without doing that, you'll still need to monitor some event, say volume keys pressed or device being shaken for instance, or have you app be running already in the foreground such as what Facebook messenger does (or used to do, I don't know)
Related questions:
What APIs in Android is Facebook using to create Chat Heads?
Listen to volume buttons in background service?
How to detect shake event with android?
Demo of bubbles

how to get android system bottom keys back?

I'm developing an android app that blocks incoming phone calls while running.
but after a block sequence android's main keys(Back,Home,..) just changes to a dotted circle !
can any one please tell me what is this
and help me to get main buttons back?
by the way - i'm testing on : Sony C2305(Android 4.2.2)
This is what happens when your android phone is ringing(in default). since you changed default functionality of androids caller mechanism so its what really happen:
1- your phone rings and default caller turns on and hides android system keys in order to display caller screen
2- your application launches too and rejects call using code(and not androids caller application)
3- so as call rejected so androids default application closed with no response(without getting KEYs back!)
Thats it.
so i guess you should work with main caller istead of your own code to solve this problem.
Hope help you

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.

Categories

Resources