1. Check out our companion app, Forums for Android! Download from Google Play

Tasker: Would like to detect whether or not I'm in a phone call

Discussion in 'Android Apps & Games' started by sportsdude81, Sep 13, 2010.

  1. sportsdude81

    sportsdude81 Member
    Thread Starter
    16

    Aug 3, 2010
    10
    1
    16
    I would like to use the variable of being in a phone call, so that tasker will leave my bluetooth on when i unplug my headphone jack. I figure i can make an exit task to turn on bluetooth or call on another profile, but don't know how to set the context variable of being in a call. Thanks in advance for any help.
     

    Advertisement

  2. UncleMike

    UncleMike Well-Known Member
    163

    Nov 15, 2009
    2,323
    484
    163
    Central NJ
    I expect future versions of Tasker will have a better way of doing this, but here's how you can do it now:

    Profile 1
    Context: Phone Offhook
    Task:
    Variable Set %INCALL = 1

    Profile 2
    Context: Phone Idle
    Task:
    Variable Clear %INCALL

    In another task or profile you can check to see if you're on a call by testing for %INCALL > 0.
     
    sportsdude81 likes this.
  3. sportsdude81

    sportsdude81 Member
    Thread Starter
    16

    Aug 3, 2010
    10
    1
    16
    Thanks. That's exactly what I was looking for. I also now understand how the if statements work
     
  4. sportsdude81

    sportsdude81 Member
    Thread Starter
    16

    Aug 3, 2010
    10
    1
    16
    after a couple of weeks of testing I realized that Phone Idle never gets called. so bluetooth always stays on. Just wondering if anybody new when exactly phone idle gets called?
     
  5. UncleMike

    UncleMike Well-Known Member
    163

    Nov 15, 2009
    2,323
    484
    163
    Central NJ
    I haven't used Phone Idle since Incoming Call became available, but it worked the last time I used it. It should "activate" when the phone goes back on hook (call disconnects or you hangup without completing an outgoing call or answering an incoming call). I just did a quick test by creating the following profile:

    Context: Phone Idle
    Task:
    Flash "Phone idle"

    I then placed an outgoing call and aborted the call before it was answered and the message appeared right after I hung up.

    Is it possible that something else isn't working that's making it appear as though Phone Idle isn't working? Have you tried using a Notify action as part of the task to provide some lasting evidence that the task actually executed?
     
    sportsdude81 likes this.
  6. RichSz

    RichSz Not Entitled
    313

    Jul 9, 2010
    2,087
    1,174
    313
    Male
    Software Engineer
    Between Imladris and Lothl
    If Phone Idle isn't working couldn't you clear %INCALL in Profile 1's exit action? I haven't tried this, just thinking about it.
     
  7. UncleMike

    UncleMike Well-Known Member
    163

    Nov 15, 2009
    2,323
    484
    163
    Central NJ
    No, because Phone Offhook is an event, and events don't have exit tasks. Good thought though.
     
  8. sportsdude81

    sportsdude81 Member
    Thread Starter
    16

    Aug 3, 2010
    10
    1
    16
    Haha I did that same test last night. I think it doesn't work because when a bluetooth device is paired with the phone the phone does not go Idle until the device is unconnected. If I disconnect the device it works but if the device is still connected it doesn't work.

    So I can live with that. Thanks for the help
     
  9. UncleMike

    UncleMike Well-Known Member
    163

    Nov 15, 2009
    2,323
    484
    163
    Central NJ
    Hmm... it never occurred to me to check that. Glad you figured it out.
     
  10. sportsdude81

    sportsdude81 Member
    Thread Starter
    16

    Aug 3, 2010
    10
    1
    16
    Apparently That wasn't the problem either because I did some tweaking and now it works flawlessly. Here are my profiles in case anybody is interested.

    Profile: 1
    Context: Phone Offhook
    Variable: Variable Set %INCALL 1

    Profile: 2
    Context: Phone Idle
    Variable: Variable Set %INCALL 0



    I also put profile 2 in the profile I was using to start bluetooth. Just for good measure, and in the exit task of the profile turning on bluetooth I had these 2 profiles.

    Profile: 1
    Bluetooth set on
    if %INCALL ~ 1

    Profile: 2
    Bluetooth set off
    if %INCALL ~ 0

    I know there are a couple of redundancies in there, but that is how I got it to work. Thought I should share.
     
    BubbleSoap likes this.

Share This Page

Loading...