AutoNotification Stop Task if notification already exists

Discussion in 'AutoApps' started by scotts, Feb 27, 2016.

  1. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    I have a notifications Profile that executes certain actions based on the app notification received. However, I don't want those actions to execute if there already is a notification from the respective app.

    I've tried the below at the beginning of the Task, however, it doesn't stop the Task.

    Any suggestions?

    Enter: Anon (53)
    A1: AutoNotification Query [ Configuration:Has Reply Action: false
    Get All Fields : false Package:com.joaomgcd.autonotification Name:AutoNotification Query Timeout (Seconds):20 Continue Task After Error:On ]
    A2: Stop [ With Error:Off Task: ] If [ %anapp() ~ %anapp ]

    MotoX2014, via TapaTalk
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    I don't think you can directly compare %anapp() with %anapp. You can probably use %anapp in the query though, and if there are any results then notifications from that app already exist :)
     
  3. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    Without having to account for every app manually, could I then do something like this...

    Query %anapp()
    Var set: %appswithnots to %anapp()
    Query %anapp
    Stop if %anapp ~%appswithnots


    MotoX2014, via TapaTalk
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Wait, how are you calling that task? is that from another task?
     
  5. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    No, it would be triggered from within the same task. I suppose I could create another task solely to do the querying. There must be a way, though, to compare new notification to a query.

    MotoX2014, via TapaTalk
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you please post the full profile? Thanks
     
  7. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    Code (Text):

    Profile: Notifications (9)
        Priority: 15 Notification: no
        Event: AutoNotification Intercept [ Configuration:Event Behaviour: true
    Notification Type: Only Created Notifications
    Persistency Type: Both
    Has Reply Action: false
    Notification Apps: ...
    Get All Fields : false
    Get Internal Actions: false
    Get Internal Actions Big: false ]
        State: Variable Value [ %Profile !~ Exercise & %Bedside !Set ]
    Enter: Anon (53)
        A1: Stop [ With Error:Off Task: ] If [ %ANAPPset ~ %anapp & %TIMES < %ANAPPtime ]
        A2: Vibrate [ Time:125 Continue Task After Error:On ] If [ %Power !Set & %Offhook !Set & %BattLevel !Set ]
        A3: If [ %Offhook Set ]
        A4: Variable Set [ Name:%NewNotifications To:1 Do Maths:Off Append:Off ]
        <GTasks>
        A5: Else If [ %anapp ~ GTasks ]
        A6: [X] Flash [ Text:Task reminder: %antitle Long:Off ] If [ %SCREEN ~ on ]
        A7: Snackbar Without Button [ Configuration:Message: Task reminder: %antitle Package:com.nick.mowen.sceneplugin Name:Snackbar Without Button Timeout (Seconds):0 Continue Task After Error:On ] If [ %SCREEN ~ on ]
        A8: Say [ Text:Task reminder: %antitle Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Respect Audio Focus:Off Network:On Continue Task Immediately:Off Continue Task After Error:On ] If [ %SCREEN ~ off ]
        <Flight Check-in>
        A9: Else If [ %anapp ~ Pushbullet & %antitle ~ Flight Check-in ]
        A10: [X] Flash [ Text:Check-in for upcoming flight Long:Off ] If [ %SCREEN ~ on ]
        A11: Snackbar Without Button [ Configuration:Message: Check-in for upcoming flight Package:com.nick.mowen.sceneplugin Name:Snackbar Without Button Timeout (Seconds):0 Continue Task After Error:On ]
        A12: Say [ Text:Check-in for upcoming flight Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Respect Audio Focus:Off Network:On Continue Task Immediately:Off Continue Task After Error:On ] If [ %SCREEN ~ off ]
        <Calendar>
        A13: Else If [ %anapp ~ Calendar ]
        A14: [X] Flash [ Text:Calendar Event Long:Off ] If [ %SCREEN ~ on ]
        A15: Snackbar Without Button [ Configuration:Message: Calendar Event Package:com.nick.mowen.sceneplugin Name:Snackbar Without Button Timeout (Seconds):0 Continue Task After Error:On ] If [ %SCREEN ~ on ]
        <Dallas Stars Start>
        A16: Else If [ %anapp ~ Stars & %anticker ~ *Game Start* ]
        A17: [X] Flash [ Text:Stars game started Long:Off ] If [ %SCREEN ~ on ]
        A18: Snackbar Without Button [ Configuration:Message: Stars game started Package:com.nick.mowen.sceneplugin Name:Snackbar Without Button Timeout (Seconds):0 Continue Task After Error:On ] If [ %SCREEN ~ on ]
        A19: Say [ Text:Dallas Stars game started Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Respect Audio Focus:On Network:Off Continue Task Immediately:Off ] If [ %SCREEN ~ off ]
        A20: Perform Task [ Name:Dallas Stars-LIFXLR1 Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] If [ %Profile ~ Home ]
        <H9 Event>
        A21: Else If [ %NTITLE ~ *,H9 Event,* ]
        A22: Play Ringtone [ Type:Notification Sound:Fomalhaut Stream:5 ] If [ %SCREEN ~ off ]
        A23: End If
        A24: Variable Set [ Name:%ANAPPset To:%anapp Do Maths:Off Append:Off ]
        A25: Variable Set [ Name:%ANAPPtime To:%TIMES + 10 Do Maths:On Append:Off ]
     
    MotoX2014, via TapaTalk
     
    Last edited by a moderator: Mar 3, 2016
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Wait, there's something I'm not getting:

    if you're intercepting a notification from an app, there'll ALWAYS be a notification from that app present at that time since that's precisely what you're reacting to: the creation of that notification. :) Or am I missing something?
     
  9. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    Presently, if I receive multiple notifications from the same app, the respective actions I've set up execute. What I want... If I receive a notification from an app that already has a notification present, I don't want the actions to execute.


    MotoX2014, via TapaTalk
     
  10. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    So you want to get present notifications that do not match the notification you just received?
     
  11. scotts

    scotts Member

    Joined:
    Jun 19, 2015
    Messages:
    140
    Likes Received:
    1
    Not sure how else to explain it... I want my notifications Task to Stop if there already is a notification in the shade from that app. For example...

    @ 12:00, I received a notification from my Google keep app and my Task Actions are executed. This notification remains in the shade.

    @ 12:30, I received another notification from my Google keep app, but because there's already a notification in the shade from this app, the Task Actions don't execute; they are stopped.


    MotoX2014, via TapaTalk
     
  12. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    You could try using AutoNotification Query and setting the Title field to %antitle and the text field to %antext

    If you get back 2 or more results, then don't execute the task. If you only get back one, do execute the task.

    Hope this helps
     

Share This Page