Bring Task to foreground through Notify

394 views
Skip to first unread message

francwalter

unread,
Mar 3, 2016, 5:37:55 AM3/3/16
to Tasker
Hallo
I have a task which I want to keep in foreground. But if I get e.g. some message through another app, the task screen is gone after I close this other app.
So I added a Notify (permanent) with a Perform Task Action. This Task is the same Task which is in background.
But it doesn't work like this.
Further I create an App from this Task through App Factory, same problem, the app is in background when some other app interferes and I cannot bring it back to foreground without using Androids "Recent Apps" button.

Is there a way to bring a Task or an App Factory App to the foreground by any means, especially through a Notify (Perform Task Action) in Tasker?

Thank's

frank

Rich D

unread,
Mar 3, 2016, 8:57:21 AM3/3/16
to Tasker Google Groups Post

This is a bit  confusing..

>
> Hallo
> I have a task

Do you mean A scene ?

Try setting the scene properties to activity.  And show the scene as a activity.

which I want to keep in foreground. But if I get e.g. some message through another app, the task screen is gone after I close this other app.
> So I added a Notify (permanent) with a Perform Task Action. This Task is the same Task which is in background.
> But it doesn't work like this.

My guess would be you are getting a error because the scene you are trying to show has already been created.
Try adding a destroys scene action just before the show scene action.

>
could you post your exported descriptions?

To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).

francwalter

unread,
Mar 3, 2016, 9:33:30 AM3/3/16
to Tasker
Am Donnerstag, 3. März 2016 14:57:21 UTC+1 schrieb Rich D:

This is a bit  confusing..

>
> Hallo
> I have a task

Do you mean A scene ?


Sorry you right, it is a scene, called through a task.
In the task I put the Notify with the Perform Action (to perform again the same Task).
 

Try setting the scene properties to activity.  And show the scene as a activity.


It is already an Activity, Full Window, No Bar


My guess would be you are getting a error because the scene you are trying to show has already been created.
Try adding a destroys scene action just before the show scene action.


Doesn't change things. I put directly before the Action "Show Scene" a "Destroy Scene" but not a change.
I am not able to recall this app from my Notify, but neither from the "Recent Tasks" from Android.
Collistion handling of the task ist Abort existing task.

Funny thing: when I press the Recent Apps Button and press my (Tasker-)App (which I can indeed see in the list) then not the app opens but Tasker! Which is maybe a little bug in the App Factory.

Only when I start again the App through the App-Icon, then it runs. I close it and immediately it reopens again, depending how often I had pressed (in vain) the Button in the Notify.

When I run the Task from Tasker (not the App-Factory App of it) then the Notify Icon disappears, when I press the Home button. So this Notify only works with the App (-factory-app). Which seems strange to me too.


could you post your exported descriptions?


Maybe not the whole Scene as there are millions of similar buttons on it, so just the beginning and the end:

Scene: MacMedia
    P
:1080x1920    L:-1x-1

       
Orientation: System
       
Background Colour: #FF000000
       
Action Bar Style: System
       
Title: MacMedia
       
Subtitle:
       
Icon: null
       
Tab Labels:
   
Events:
       
Key: 547

Element: Play/Button
   
Geometry:
        P
:302,1610 474x310 L:352,660 475x275
   
Content:
       
Label:
       
Label Size: 22
       
Label Width Scale %: 100
       
Label Colour: #FFFFFFFF
       
Font:
       
Position: Centre
       
Icon: hd_ab_av_play
   
Events:
       
Click: 463
       
LongClick: 464

Element: Quit/Button
   
Geometry:
        P
:0,1760 151x160 L:352,660 475x275
   
Content:
       
Label:
       
Label Size: 22
       
Label Width Scale %: 100
       
Label Colour: #FFFFFFFF
       
Font:
       
Position: Centre
       
Icon: hd_aaa_ext_io
   
Events:
       
Click: 465
       
LongClick: 466
...

Element: switch_host/Button
   
Geometry:
        P
:2,1335 299x125 L:352,660 475x275
   
Content:
       
Label: host
       
Label Size: 14
       
Label Width Scale %: 100
       
Label Colour: #FFFFFFFF
       
Font:
       
Position: Centre
       
Icon: null
   
Events:
       
Click: 545
       
LongClick: 546




And this is the task:
 
MacMedia (462)
   
Abort Existing Task
    A1
: Display Timeout [ Secs:0 Mins:0 Hours:1 ]
    A2
: Variable Set [ Name:%vol To:1 Do Maths:Off Append:Off ]
    A3
: Variable Set [ Name:%user To:f Do Maths:Off Append:Off ]
    A4
: Variable Set [ Name:%switch To:1 Do Maths:On Append:Off ]
    A5
: Variable Set [ Name:%host To:192.168.0.120 Do Maths:Off Append:Off ]
    A6
: Variable Set [ Name:%port To:22 Do Maths:Off Append:Off ]
    A7
: Variable Set [ Name:%click To:/opt/local/bin/cliclick Do Maths:Off Append:Off ]
    A8
: Notify [ Title:MacMedia Text:is still running Icon:hd_ab_av_play Number:0 Permanent:On Priority:3 Actions:(1) ]
    A9
: Destroy Scene [ Name:MacMedia ]
    A10
: Show Scene [ Name:MacMedia Display As:Activity, Full Window, No Bar Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Continue Task Immediately:Off ]
    A11
: Display Timeout [ Secs:0 Mins:2 Hours:0 ]
    A12
: Notify Cancel [ Title:MacMedia Warn Not Exist:Off ]


The whole thing is a remote control for my mac, through ssh. To control the VLC Player, the MacBook is near the beamer, not where I am sitting when I watch movies :)

Thank's

frank



Rich D

unread,
Mar 3, 2016, 3:28:02 PM3/3/16
to Tasker Google Groups Post


>> Try adding a destroys scene action just before the show scene action.
>
>
> Doesn't change things. I put directly before the Action "Show Scene" a "Destroy Scene" but not a change.
> I am not able to recall this app from my Notify, but neither from the "Recent Tasks" from Android.
> Collistion handling of the task ist Abort existing task.
>
> Funny thing: when I press the Recent Apps Button and press my (Tasker-)App (which I can indeed see in the list) then not the app opens but Tasker! Which is maybe a little bug in the App Factory.

Huh.. not sure about that one?? I can not reproduce that.

>
> Only when I start again the App through the App-Icon, then it runs. I close it and immediately it reopens again, depending how often I had pressed (in vain) the Button in the Notify.

Strange.. that almost sounds like the preform task is queing up the tasks like a event context would if you have 'enforce task order ' selected??
I will test that on my device  later.

What priority do you have  the preform task set for??


>
> When I run the Task from Tasker (not the App-Factory App of it) then the Notify Icon disappears, when I press the Home button. So this Notify only works with the App (-factory-app). Which seems strange to me too.

That actually goes along with what is happening in the app. It sounds like the task is being qued and not killed. So when the next itteration of the task is run the scene is destroyed and so the cancel notify runs..

This can be confirmed by checking the run log. Menu / more / run log
>
>
>

Frank Röhm

unread,
Mar 3, 2016, 5:57:36 PM3/3/16
to tas...@googlegroups.com


Am 3. März 2016 21:27:40 MEZ, schrieb Rich D :
>> Funny thing: when I press the Recent Apps Button and press my
>(Tasker-)App (which I can indeed see in the list) then not the app
>opens
>but Tasker! Which is maybe a little bug in the App Factory.
>
>Huh.. not sure about that one?? I can not reproduce that.

Me neither anymore, good!

>>
>> Only when I start again the App through the App-Icon, then it runs. I
>close it and immediately it reopens again, depending how often I had
>pressed (in vain) the Button in the Notify.
>
>Strange.. that almost sounds like the perform task is queing up the
>tasks
>like a event context would if you have 'enforce task order ' selected??

Where can I set this? ?

>I will test that on my device later.
>
>What priority do you have the perform task set for??

%priority+1


>>
>> When I run the Task from Tasker (not the App-Factory App of it) then
>the
>Notify Icon disappears, when I press the Home button. So this Notify
>only
>works with the App (-factory-app). Which seems strange to me too.
>
>That actually goes along with what is happening in the app. It sounds
>like
>the task is being qued and not killed. So when the next itteration of
>the
>task is run the scene is destroyed and so the cancel notify runs..
>
>This can be confirmed by checking the run log. Menu / more / run log

Difficult, because it doesn't work at all out from tasker, as said. When I press home button the notify icon disappears, when run from tasker, the task exits then. No more task and no more icon.
The notify icon is still there only in the app.
And the run log is not used when I use the app.

So I just need a way to bring a running app into the foreground, maybe my way with that notify is totally wrong and it is done better other way?

Rich D

unread,
Mar 3, 2016, 6:09:20 PM3/3/16
to Tasker Google Groups Post

> >>
> >> Only when I start again the App through the App-Icon, then it runs. I
> >close it and immediately it reopens again, depending how often I had
> >pressed (in vain) the Button in the Notify.
> >
> >Strange.. that almost sounds like the perform task is queing up the
> >tasks
> >like a event context would if you have 'enforce task order ' selected??
>
> Where can I set this? ?

You can not. There is no setting . If this is what is happening then it would be a bug.

> >
> >This can be confirmed by checking the run log. Menu / more / run log
>
> Difficult, because it doesn't work at all out from tasker, as said. When I press home button the notify icon disappears, when run from tasker, the task exits then. No more task and no more icon.

I assume it is the tasker action that is cancelling the notify. Could you post the relevant part of the run log for the tasker portion. I relize this is not possible for the app.

>
> So I just need a way to bring a running app into the foreground, maybe my way with that notify is totally wrong and it is done better other way?

I believe this is the best method. I use this for several scenes without this issue..

Still doing some testting but the run log would be invaluable.

Frank Röhm

unread,
Mar 3, 2016, 6:53:08 PM3/3/16
to tas...@googlegroups.com


Am 4. März 2016 00:09:04 MEZ, schrieb Rich D :

>Still doing some testting but the run log would be invaluable.


This is the run log, when I start the task through a shortcut to that task on the home screen and press home button. The notify icon disappears then:


20160304 00.41.49 M Restart ID0:0.0 Monitor
20160304 00.41.56 E Start ID0:0.0 TaskService
20160304 00.41.56 T Running ID-5 MacMedia
20160304 00.41.56 T Running ID334:2 MacMedia
20160304 00.41.56 A OK ID-5.1 MacMedia.Perform Task, MacMedia
20160304 00.41.56 T ExitOK ID-5 MacMedia
20160304 00.41.56 A Disabled ID334:2.1 MacMedia.Popup
20160304 00.41.56 A Disabled ID334:2.2 MacMedia.SSH Plugin
20160304 00.41.56 A Disabled ID334:2.3 MacMedia.Var Set, %ssh_command=%ssh_command
20160304 00.41.56 A Disabled ID334:2.4 MacMedia.Secure Settings
20160304 00.41.56 A OK ID334:2.5 MacMedia.Display Timeout
20160304 00.41.56 A OK ID334:2.6 MacMedia.Var Set, %vol=1
20160304 00.41.56 A OK ID334:2.7 MacMedia.Var Set, %user=f
20160304 00.41.56 A OK ID334:2.8 MacMedia.Var Set, %switch=1
20160304 00.41.56 A Disabled ID334:2.9 MacMedia.Var Set, %host=%host
20160304 00.41.56 A Disabled ID334:2.10 MacMedia.Var Set, %host=%host
20160304 00.41.56 A Disabled ID334:2.11 MacMedia.Var Set, %host=%host
20160304 00.41.56 A OK ID334:2.12 MacMedia.Var Set, %host=192.168.0.120
20160304 00.41.57 A Disabled ID334:2.13 MacMedia.Var Set, %host=192.168.0.120
20160304 00.41.57 A OK ID334:2.14 MacMedia.Var Set, %port=22
20160304 00.41.57 A OK ID334:2.15 MacMedia.Var Set, %click=/opt/local/bin/cli..
20160304 00.41.57 A OK ID334:2.16 MacMedia.Notify
20160304 00.41.57 A OK ID334:2.17 MacMedia.Destroy Scene
20160304 00.41.57 A OK ID334:2.18 MacMedia.Show Scene
20160304 00.42.04 A Disabled ID334:2.19 MacMedia.Secure Settings
20160304 00.42.04 A OK ID334:2.20 MacMedia.Display Timeout
20160304 00.42.05 A OK ID334:2.21 MacMedia.Notify Cancel
20160304 00.42.05 T ExitOK ID334:2 MacMedia
20160304 00.42.05 E Stop ID0:0.0 TaskService



This is the same but first I press the icon to perform task, from the notify.
Then the home button.
The icon in info bar disappears and after a short time the icon reappears, and disappears again. But now my scene reappears. But no notify anymore.
Maybe this is some logic.


20160304 00.44.02 E Start ID0:0.0 TaskService
20160304 00.44.02 T Running ID-5 MacMedia
20160304 00.44.02 T Running ID334:2 MacMedia
20160304 00.44.02 A OK ID-5.1 MacMedia.Perform Task, MacMedia
20160304 00.44.02 T ExitOK ID-5 MacMedia
20160304 00.44.02 A Disabled ID334:2.1 MacMedia.Popup
20160304 00.44.02 A Disabled ID334:2.2 MacMedia.SSH Plugin
20160304 00.44.02 A Disabled ID334:2.3 MacMedia.Var Set, %ssh_command=%ssh_command
20160304 00.44.02 A Disabled ID334:2.4 MacMedia.Secure Settings
20160304 00.44.02 A OK ID334:2.5 MacMedia.Display Timeout
20160304 00.44.02 A OK ID334:2.6 MacMedia.Var Set, %vol=1
20160304 00.44.02 A OK ID334:2.7 MacMedia.Var Set, %user=f
20160304 00.44.02 A OK ID334:2.8 MacMedia.Var Set, %switch=1
20160304 00.44.03 A Disabled ID334:2.9 MacMedia.Var Set, %host=%host
20160304 00.44.03 A Disabled ID334:2.10 MacMedia.Var Set, %host=%host
20160304 00.44.03 A Disabled ID334:2.11 MacMedia.Var Set, %host=%host
20160304 00.44.03 A OK ID334:2.12 MacMedia.Var Set, %host=192.168.0.120
20160304 00.44.03 A Disabled ID334:2.13 MacMedia.Var Set, %host=192.168.0.120
20160304 00.44.03 A OK ID334:2.14 MacMedia.Var Set, %port=22
20160304 00.44.03 A OK ID334:2.15 MacMedia.Var Set, %click=/opt/local/bin/cli..
20160304 00.44.03 A OK ID334:2.16 MacMedia.Notify
20160304 00.44.03 A OK ID334:2.17 MacMedia.Destroy Scene
20160304 00.44.03 A OK ID334:2.18 MacMedia.Show Scene
20160304 00.44.10 T Running ID-615:3 System
20160304 00.44.16 A Disabled ID334:2.19 MacMedia.Secure Settings
20160304 00.44.16 A OK ID334:2.20 MacMedia.Display Timeout
20160304 00.44.16 A OK ID334:2.21 MacMedia.Notify Cancel
20160304 00.44.16 T ExitOK ID334:2 MacMedia
20160304 00.44.17 T Running ID334:4 MacMedia
20160304 00.44.17 A OK ID-615:3.1 Anon.Perform Task, MacMedia
20160304 00.44.17 T ExitOK ID-615:3 System
20160304 00.44.17 A Disabled ID334:4.1 MacMedia.Popup
20160304 00.44.17 A Disabled ID334:4.2 MacMedia.SSH Plugin
20160304 00.44.17 A Disabled ID334:4.3 MacMedia.Var Set, %ssh_command=%ssh_command
20160304 00.44.17 A Disabled ID334:4.4 MacMedia.Secure Settings
20160304 00.44.17 A OK ID334:4.5 MacMedia.Display Timeout
20160304 00.44.17 A OK ID334:4.6 MacMedia.Var Set, %vol=1
20160304 00.44.17 A OK ID334:4.7 MacMedia.Var Set, %user=f
20160304 00.44.17 A OK ID334:4.8 MacMedia.Var Set, %switch=1
20160304 00.44.17 A Disabled ID334:4.9 MacMedia.Var Set, %host=%host
20160304 00.44.17 A Disabled ID334:4.10 MacMedia.Var Set, %host=%host
20160304 00.44.17 A Disabled ID334:4.11 MacMedia.Var Set, %host=%host
20160304 00.44.17 A OK ID334:4.12 MacMedia.Var Set, %host=192.168.0.120
20160304 00.44.17 A Disabled ID334:4.13 MacMedia.Var Set, %host=192.168.0.120
20160304 00.44.17 A OK ID334:4.14 MacMedia.Var Set, %port=22
20160304 00.44.17 A OK ID334:4.15 MacMedia.Var Set, %click=/opt/local/bin/cli..
20160304 00.44.17 A OK ID334:4.16 MacMedia.Notify
20160304 00.44.17 A OK ID334:4.17 MacMedia.Destroy Scene
20160304 00.44.19 A OK ID334:4.18 MacMedia.Show Scene
20160304 00.44.19 A Disabled ID334:4.19 MacMedia.Secure Settings
20160304 00.44.20 A OK ID334:4.20 MacMedia.Display Timeout
20160304 00.44.20 A OK ID334:4.21 MacMedia.Notify Cancel
20160304 00.44.20 T ExitOK ID334:4 MacMedia
20160304 00.44.20 E Stop ID0:0.0 TaskService
20160304 00.44.28 E Start ID0:0.0 TaskService
20160304 00.44.28 T Running ID347 Anon
20160304 00.44.28 A OK ID347.1 Anon.Flash
20160304 00.44.28 A Disabled ID347.2 Anon.Flash
20160304 00.44.28 A Disabled ID347.3 Anon.Var Set, %ssh_command=%ssh_command
20160304 00.44.28 A Disabled ID347.4 Anon.SSH Plugin
20160304 00.44.28 A OK ID347.5 Anon.Destroy Scene
20160304 00.44.28 A Disabled ID347.6 Anon.Stop
20160304 00.44.28 T ExitOK ID347 Anon
20160304 00.44.28 E Stop ID0:0.0 TaskService


Rich D

unread,
Mar 3, 2016, 7:55:34 PM3/3/16
to Tasker Google Groups Post


>
> This is the run log, when I start the task through a shortcut to that task on the home screen and press home button. The notify icon disappears then:

Ok, I misunderstood the issue. : I thought the notify was disapearing just after clicking on the notify button. The log shows things are working as expected. When you push the home button this destroys the scene and allows the task to continue so the notify cancel action runs..

The  main issue here is that you have the  'continue task immediately' option disabled in the 'show scene action. The problem  with that is you can not be sure of when your scene will be destroyed so you will get unreliable results. A better approach would be - once you show the scene then   transfer control to the scene. In other words set the 'show scene' action to  'continue task immediately' and  make it the last action in the task.
So in your case  you could put the notify cancel action in your Quit/Button task.

I would start by making these changes and get the  tasker end working first. Then   see if it fixes the app.

Post back if this is not clear..

francwalter

unread,
Mar 4, 2016, 1:44:02 AM3/4/16
to Tasker


Am Freitag, 4. März 2016 01:55:34 UTC+1 schrieb Rich D:

...  The log shows things are working as expected.  When you push the home button this destroys the scene

and allows the task to continue so the notify cancel action runs..


Then I misunderstood the scene. I thought the scene goes to the background like any other apps GUI too. When I press Home Button having any other app in foreground, they go to the background, waiting for me to open them again. Or waiting for Android OS to kill them because they are unused. But not in the next seconds like this scene. When I press then the Recent Apps Button, I can bring them back.

How can I avoid then the scene from beeing destroyed?
So that is my issue.
 

... The problem  with that is you can not be sure of when your scene will be destroyed so you will get unreliable results.


OK, I did you proposal and put the Notify Cancel to the scenes Quit actions and - what heaven? - now the Notify keeps in Info Bar and when I press Home Button the Scene goes background but the Notify keeps there!
Now when I press the Notify (Perform Task Button), voila! there the Scene is again in foreground! It works!
Exactly that I wanted!
Thank's!
Now only a cosmetical problem keeps: when I press the Notify Perform Task's Button, the Notification Bar doesn't go automatically up. I need to swype it manually up to use the scene.
Is that possible to set that somehow, to collapse the notification bar?
Anyway, thanks for help appreciatedly!!

frank

Rich D

unread,
Mar 4, 2016, 7:06:24 AM3/4/16
to Tasker Google Groups Post


>
> Then I misunderstood the scene. I thought the scene goes to the background like any other apps GUI too. When I press Home Button having any other app in foreground, they go to the background, waiting for me to open them again. Or waiting for Android OS to kill them because they are unused. But not in the next seconds like this scene. When I press then the Recent Apps Button, I can bring them back.
>
> How can I avoid then the scene from beeing destroyed?
> So that is my issue.

I am probably just confusing the  issue. I should not have said the scene gets destroyed. If you check in the user guide you will find a scene has these states it  can be in  ( uncreated, hidden, visible, background (shown but currently not on screen)) your perception of how a scene shown as a activity is handled   is probably correct for the  most part. To be honest I do not  know exactly  how  each state is  handled. I do know that a scene  is handled differently within a app from the factory and tasker.

So when you  hit the home button I believe the scene goes to hidden or background ,(not sure which one) and this allows the task to continue. So you could simply test the scene at this point to figure out what state it is in then  not do the  notify cancel . I have always found it easier to avoid this all together and just transfer control to the scene itself.
The same goes for using the  destroy scene action prior to the show scene action. The correct method is to test the scene  then act accordingly. But some times it is just as easy to destroy it first because you will not  get a error if you destroy a scene that is not created or shown but  you will get a error if you  show a scene  that is already being shown.
>  
So , I believe in theory once you show a scene as a activity it should persist until you  destroy it with  the tasker  destroy scene action. And you should be able to simply  re-show the scene (after testing the state) and still have  all of your scene data in tact.

The key action you were missing is the 'test scene' action.  If you do this at the beginning of the task you will then know if you want to just show the scene (IE the scene is in background or hidden) or if you want to  set all your variables and then show the scene (IE the scene is  uncreated) or do nothing (IE the scene is  visable)

> Is that possible to set that somehow, to collapse the notification bar?

There is a tasker action for that.
You could put it at the begining of your task.

> Anyway, thanks for help appreciatedly!!
>
> frank
>

> --
> You received this message because you are subscribed to the Google Groups "Tasker" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
> Visit this group at https://groups.google.com/group/tasker.
> For more options, visit https://groups.google.com/d/optout.

Rich D

unread,
Mar 4, 2016, 7:55:57 AM3/4/16
to Tasker Google Groups Post


> The key action you were missing is the 'test scene' action.  If you do this at the beginning of the task you will then know if you want to just show the scene (IE the scene is in background or hidhden) or if you want to  set all your variables and then show the scene (IE the scene is  uncreated) or do nothing (IE the scene is  visable)

I am not sure which sate will give you a error when trying to re-show the scene. You will have to test this.  Turn on and check run log. You can also turn on 'show pop up errors' in the tasker preferences.

francwalter

unread,
Mar 4, 2016, 8:29:48 AM3/4/16
to Tasker
Am Freitag, 4. März 2016 13:06:24 UTC+1 schrieb Rich D:


...

> Is that possible to set that somehow, to collapse the notification bar?

There is a tasker action for that.
You could put it at the begining of your task.


Oh, yeah! Found it under Display. This didn't work when I put it in the Taskers beginning, so I created a new Task just to launch my Task.
Now it works perfekt! In the Tasker's Task Shortcut and in the App-Factory-App!

Thank a lotty for this detailed help, making me understand bittly more that huge Tasker :)

If anyone is interested, I can export my Tasks and Scenes. But it is very much individualized and would need a lot of adaption to own needs, I guess.
Hier is a screenshot, two third of the upper part is for VLC Player, but the lower third is doing basic commands, as ARROWS, RETURN, ESC, TAB, individual command etc.

 



Reply all
Reply to author
Forward
0 new messages