AutoNotification Intercept Notification and variables

Discussion in 'AutoApps' started by Martin, Jan 20, 2016.

  1. Martin

    Martin Member

    Joined:
    Mar 9, 2015
    Messages:
    51
    Likes Received:
    0
    Hi i'm trying to make a task where i intercept notification and from the text of the notification work with if. So what i need is to convert the notification into a variable all inside the same task. with several task i have no problems.

    PD i just fund the options. Thanks and sorry
     
    Last edited: Jan 20, 2016
  2. Martin

    Martin Member

    Joined:
    Mar 9, 2015
    Messages:
    51
    Likes Received:
    0
    On another side, is there an option or function so the task wait until the notification apears so it can read it?
     
  3. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Yes, use the AutoNotification Intercept event condition in Tasker. Hope this helps
     
  4. Martin

    Martin Member

    Joined:
    Mar 9, 2015
    Messages:
    51
    Likes Received:
    0
    what I need is: I run a backup soft from Tasker, the only way that I have to know how the backup goes is from the app notification, then depending on how it goes, diferents options, but since the app is a plugin once it pass immediately continues, so what I'm trying to accomplish is something like wait until the notification of the app apears so I can read the what happend

    Enviado desde mi SM-G900M mediante Tapatalk
     
  5. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    The simplest solution is to have your launching tasks initiate the backup and then quit. When the AutoNotification event triggers, have the profile's entry task perform the "depending how it goes" option.

    If you really need to have the launching task wait (because "depending how it goes" also depends on some local variables for instance) then clear a global variable (ie Variable Clear %ANResponse) in the launching task and set up a loop to wait until %ANResponse is set. Then in the AutoNotification profile, set %ANResponse to the result.
     
  6. Martin

    Martin Member

    Joined:
    Mar 9, 2015
    Messages:
    51
    Likes Received:
    0
    Sorry here is what i have:

    Backup (34)
    A1: Call Logs Backup & Restore [ Configuración:Crear Nueva Copia de Seguridad Paquete:com.riteshsahu.CallLogBackupRestore Nombre:Call Logs Backup & Restore Cuenta atrás (segundos):0 ]
    A2: Esperar [ MS:0 Segundos:20 Minutos:0 Horas:0 Días:0 ]
    A3: AutoNotification Query [ Configuración:Title: Call Logs Backup & Restore
    Has Reply Action: false
    Get All Fields : false Paquete:com.joaomgcd.autonotification Nombre:AutoNotification Query Cuenta atrás (segundos):20 ]
    A4: Establecer variable [ Nombre:%logtext A:%antext() Calcular:Apagado Añadir:Apagado ]
    A5: AutoNotification Cancel [ Configuración:Cancel All: false
    Notification Title: Call Logs Backup & Restore (exact)
    Notification Text: Copia de seguridad completa (regex) (case ins) Paquete:com.joaomgcd.autonotification Nombre:AutoNotification Cancel Cuenta atrás (segundos):0 ]
    A7: Esperar hasta [ MS:0 Segundos:5 Minutos:0 Horas:0 Días:0 ] Si (if) [ %logtext ~R Copia de seguridad completa | %qtime > 30 ]

    My problem is between A1 and A3, because A1 takes sevel second, and without A2, A3 runs a find nothing.
    Whan i want to know if there is a way to A3 waits until the notification of A1 apears.
    My reazon to make it in one task is to optimeze aand practice.
     
  7. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    I am not sure making it just one task is "optimized". For my simple solution above your task would consist solely of A1. The profile that gets triggered when the notification is returned would run A4-A7. Tasker would essentially be idle (monitoring) until the profile is triggered.

    You need to think in terms of "Event Based" programming instead of "Procedural" programming.

    For your solution, you will have to continually query for the notification (using up resources and CPU cycles) until it is found.

    But to do what you want, just add another action after A3
    GOTO A2 if query returns nothing

    The task will wait another 20 seconds and query again, repeating until a notification is received.

    You should also account for the possibility that you never receive a notification. Make sure you set the properties of the task to "abort existing" so the next backup can start if the previous one is still waiting. Or put a counter inside the loop and a STOP action if the counter gets greater than the number of waits that seems reasonable.
     
  8. Martin

    Martin Member

    Joined:
    Mar 9, 2015
    Messages:
    51
    Likes Received:
    0
    thanks
    I understand what you say but this task take a few seconds.
     
    Last edited: Jan 20, 2016

Share This Page