Scene disappearing of recently-used apps

221 views
Skip to first unread message

Pablo Badia

unread,
Mar 23, 2014, 7:19:24 AM3/23/14
to tas...@googlegroups.com
I exported a project as an app (tasks and one scene). App itself working great.

The problem is I can't see it in the list of recently-used apps once I press the Home button (I don't handle anything in the key event of the scene) and more troublesome I can't return to it. 
However it's still running. I think this is a problem of scene handling but I can't figure it out. Usually I don't bother cause I use scenes more as dialog / popup than anything, but I want an app behaviour for this one.

The problem in Tasker is the same, if I run the task who shows the scene and then press the Home or Recent apps button, I can't retun to Tasker by the list of recently-used apps and when I do I see that the scene is still running.

Sorry for my english btw, i'm french. Thanks for any help.

Dale Smith

unread,
Jun 9, 2014, 5:12:23 PM6/9/14
to tas...@googlegroups.com
I'm having the same problem but I haven't made an app out of the Profiles and Tasks yet.  My scene will hide (i.e. go into background mode) itself usually after the Android display timeout has blanked the display but not always. I can get the scene to show itself if I enter the Tasker app, exit and then tap the shortcut I have on my home screen. Tapping the shortcut without entering Tasker first does will not show the scene.I haven't noticed any display time off relationship yet but I going to start noting the time off and to see if there might be one.  Pablo, no apologies are necessary. Your English is much better then the English spoken by most Americans these days. 

Brandon Horwath

unread,
Jun 9, 2014, 5:17:46 PM6/9/14
to tas...@googlegroups.com
Unfortunately, there's no way to detect a 'home button press' that info just isn't sent to other apps. Been that way since api 1.

A long press, or a recent apps button press is. You'll need to look at key events, either by label (I think app switch press is APP_SWITCH) or by code (probably varies by device).

One way you could get around this is by destroying the scene. After it is created, wait one second, test the scene, if the result doesn't match visible, destroy the scene. This will allow it to reappear once activated again.

Hope this helps.

Brandon Horwath

unread,
Jun 9, 2014, 5:25:37 PM6/9/14
to tas...@googlegroups.com
One way you could get around this is by destroying the scene. After it is created, wait one second, test the scene, if the result doesn't match visible, destroy the scene. This will allow it to reappear once activated again.

Should mention, this needs to be looped like so:

A4: Perform Task [ Name:Display Scene Calendar Stop:Off Priority:%priority + 1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] If [ %Cal_selected(#) = 0 ]
A5: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
<testing>
A6: Test Scene [ Name:Select Calendar Test:Status Store Result In:%scene ]
A7: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A8: Goto [ Type:Action Label Number:4 Label:testing ] If [ %scene ~ visible ]
A9: Destroy Scene [ Name:Select Calendar ] If [ %scene !~ uncreated ]

In this example, %Cal_selected() will have a value once a selection is made on the menu element for the scene. This means, if the user made the selection and just selected the home button instead of exit everything works normally as if the user selected exit. If no selection was made, the scene is destroyed to be displayed again when the user selects the function.

Hope this is what you're looking for.

Pablo Badia

unread,
Jun 10, 2014, 2:37:41 AM6/10/14
to tas...@googlegroups.com
Hi everybody,

I figured it out a time ago but not came back here since. As Brandon says keys events allow us to handle that. 

By the way Brandon the label HOME works fine for me, even for a short press (Nexus 5).

Whenever I press the back, home or app switch button (labels : back/HOME/APP_SWITCH), the scene is destroyed.
This way I don't bother to test if the scene is visible or not, just create & show it when I need it then destroy it. This works great for my purpose (todo list app). 

Hope it helps (credits given to Brandon).

Brandon Horwath

unread,
Jun 10, 2014, 2:56:17 AM6/10/14
to tas...@googlegroups.com
Interesting.

This documentation states otherwise.

http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_HOME

But, wise man say, "can't argue with results".

Brandon Horwath

unread,
Jun 10, 2014, 2:59:50 AM6/10/14
to tas...@googlegroups.com
FYI, tested on mine... no luck. Doesn't register, recognize, intercept, or stop home button press.

Everything else though.

Pablo Badia

unread,
Jun 10, 2014, 3:15:44 AM6/10/14
to tas...@googlegroups.com
You made me doubt, but I just tested it 3 times. I confirm that the scene is destroyed when I press the home button. 
Did you try with back/HOME/APP_SWITCH ? Maybe it is another label who makes it works (highly unlikely but...)
Did you check the "stop event" box in the KEY tab ? Dunno if it's relevant but I can't explain why it wont work on yours.

Pablo Badia

unread,
Jun 10, 2014, 3:21:55 AM6/10/14
to tas...@googlegroups.com
Another more likely theory : the launcher I have installed (Nova) allows to handle more key presses than the defaut launcher (not in Tasker though). Maybe it "fixes" that.

Brandon Horwath

unread,
Jun 10, 2014, 3:57:54 AM6/10/14
to tas...@googlegroups.com
the launcher I have installed (Nova) allows to handle more key presses than the defaut launcher

As I had tried every version of your previous post, I suspect the latter is much more likely. I'm using stock HTC sense 4. I like the sense widgets more but nova is a nice launcher.

It's reassuring to note that the tasker documentation regarding key_events in scenes is correct. (Well, maybe not for all users. I still believe the developers link and reference is legitimate.) And tasker does reference a higher link within the same page of the website.

Reply all
Reply to author
Forward
0 new messages