Call answered?

112 views
Skip to first unread message

Mark Ford

unread,
Jan 22, 2015, 12:53:17 PM1/22/15
to tas...@googlegroups.com
Is there a way to determine the state of a call e.g. the other person has answered the phone / hung up etc.

Pent

unread,
Jan 22, 2015, 2:53:36 PM1/22/15
to tas...@googlegroups.com
You can't (easily) find when the call is answered, but hung up is the Phone Idle event.

Pent

Abdullah Alahdal

unread,
Jan 22, 2015, 4:49:22 PM1/22/15
to tas...@googlegroups.com
With AutoInput, you can use UI query and get it. I've tried to make below profile to perform the same.


Profile: Test (82)
State: Call [ Type:Any Number:* ]
Enter: Test (29)
A1: AutoInput UI Query [ Configuration:Variables: duration Package:com.joaomgcd.autoinput Name:AutoInput UI Query Timeout (Seconds):20 ]
A2: If [ %duration ~R (\d\d:\d\d) ]
A3: Flash [ Text:Connected Long:Off ]
A4: Else If [ %PACTIVE ~ *,Test,* ]
A5: Goto [ Type:Action Number Number:1 Label: ]
A6: End If

David Wang

unread,
Jan 23, 2015, 12:56:13 AM1/23/15
to tas...@googlegroups.com
Another way to check phone/call state.  Maybe this thead remind me of another feature-request now. 

You can't (easily) find when the call is answered, but hung up is the Phone Idle event.
Yes, currently we can use "Phone Idle" event  to trigger a task to set a variable which will be represented as phone/call state. Then we can use the former variable in our other tasks. But it's not that convenient for us. So I think Tasker should implement a "Phone/Call state" function in the category of "Phone ---> Test Phone".

In fact, we can check phone/call state at any time with some internal classes in android(I mean "com.android.internal.telephony.ITelephony"). See here and here for reference.

I made a task using "Java Function" of Tasker. It works very well. Xml file attached. 
Note: The Java lines below is unusable in Tasker. I use reflection instead.
 ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));

It will be much better if Tasker intergrate the same function into "Test Phone---> Phone State". Just my brainstorm. :-)


JavaCode_call_internal_class.tsk.xml

Pent

unread,
Jan 23, 2015, 2:32:00 AM1/23/15
to tas...@googlegroups.com

Yes, currently we can use "Phone Idle" event  to trigger a task to set a variable which will be represented as phone/call state. Then we can use the former variable in our other tasks. But it's not that convenient for us. So I think Tasker should implement a "Phone/Call state" function in the category of "Phone ---> Test Phone".

Using that logic, there should be a test for every possible profile condition...

Great code example though!

Pent
Reply all
Reply to author
Forward
0 new messages