1. Download our Official Android App: Forums for Android!

Wait until %TIME == Desired time

Discussion in 'Android Apps & Games' started by amankhalid, Apr 12, 2018.

  1. amankhalid

    amankhalid Newbie
    Thread Starter
    Rank:
     #1,047
    Points:
    16
    Posts:
    11
    Joined:
    Jul 5, 2014

    Jul 5, 2014
    11
    2
    16
    Hi,

    I am working on a Tasker based app that starts a sub task. The main task performs an action (displays the result) and exits but the sub task performs the same action at 9am and 9pm only and then generates notifications if required.

    My present implementation is that when the app is launched:
    a) the sub task checks the value of %TIME
    b) calculates the difference in seconds between %TIMES and “the next action time (9am or pm)”
    c) calls Tasker action “wait” for the duration of seconds calculated above

    I chose this approach because I don’t know if Tasker allows to just say “sleep until 9am”. If this is possible, which action should I be using? Is that the best battery friendly approach?

    Regards
    Aman
     

    Advertisement

  2. Thom

    Thom  
    VIP Member
    Rank:
     #20
    Points:
    1,318
    Posts:
    11,851
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,851
    4,892
    1,318
    Male
    Software Developer
    Keene, NH USA
    The typical method for doing a timed task in Tasker is to use a Profile that has a Time action. When the time arrives the Enter task is launched.

    ... Thom
     
  3. amankhalid

    amankhalid Newbie
    Thread Starter
    Rank:
     #1,047
    Points:
    16
    Posts:
    11
    Joined:
    Jul 5, 2014

    Jul 5, 2014
    11
    2
    16
    Hi,

    The profile based action works well but it does not immediately fire the app to show a scene. Is there a way to do that?

    Regards
    AK
     
  4. Thom

    Thom  
    VIP Member
    Rank:
     #20
    Points:
    1,318
    Posts:
    11,851
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,851
    4,892
    1,318
    Male
    Software Developer
    Keene, NH USA
    Two Profiles?

    ... Thom
     
  5. amankhalid

    amankhalid Newbie
    Thread Starter
    Rank:
     #1,047
    Points:
    16
    Posts:
    11
    Joined:
    Jul 5, 2014

    Jul 5, 2014
    11
    2
    16
    Hi,

    If there are two profiles in my project to handle this functionality, is it possible to generate one APK using Tasker factory that has two separate triggers/profiles?

    Regards
    AK
     
    Ahmad yakubu likes this.
  6. Thom

    Thom  
    VIP Member
    Rank:
     #20
    Points:
    1,318
    Posts:
    11,851
    Joined:
    Feb 16, 2011

    Feb 16, 2011
    11,851
    4,892
    1,318
    Male
    Software Developer
    Keene, NH USA
    The structure of Tasker is ... Profile ... Task ... Scene ... Project. I have a Project with 5 Profiles, 15 Tasks, and 12 Scenes.

    The answer to your question is to have a Project with two Profiles and crate an APK from it.

    ... Thom
     

Share This Page

Loading...