Project that runs ok under Tasker but stops when .apk is loaded.

56 views
Skip to first unread message

John Spillett

unread,
Feb 24, 2015, 8:19:18 AM2/24/15
to tas...@googlegroups.com
This project downloads pictures from webcams and displays them. It runs ok as a Tasker Project but when made into an .apk the loaded app stops.

I have run out of ideas . Any suggestions as to where to go forward please.

Regards John
TRAFFICCAMS.prj.xml
2015-02-24_12-45-40 (1).png

Rich D

unread,
Feb 24, 2015, 8:23:31 AM2/24/15
to Tasker Google Groups Post


It runs ok as a Tasker Project but when made into an .apk the loaded app stops.
>
> I have run out of ideas . Any suggestions as to where to go forward please.
>

Could you give more details..  your scree shot looks fine. From there, You should be able to select the green guy and install the app..

Rich D

unread,
Feb 24, 2015, 8:25:33 AM2/24/15
to Tasker Google Groups Post


And could you post the exported descriptions as well.
Just paste them directly in the post.

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).

John Spillett

unread,
Feb 24, 2015, 10:35:04 AM2/24/15
to tas...@googlegroups.com
As you say looks ok from the screenshot. Selecting the "green guy" installs the app ok but when any action on the first screen of the app is touched it results in a "Sorry the app has stopped message".

There are no Profiles but 10 Tasks and 12 Scenes.

If you import the xml into your Tasker you can see the program structure.

The task descriptions are attached.
TRAFFIC (608).txt

Rich D

unread,
Feb 24, 2015, 11:05:36 AM2/24/15
to Tasker Google Groups Post


Have you tried putting in some flashes to see if it is just not starting or is starting then failing?

Are you sure you have the correct launch task selected?

Jeremy Harris

unread,
Feb 24, 2015, 10:01:23 PM2/24/15
to tas...@googlegroups.com
John, I installed the project and tried to export an apk, but it looks like I need to update Tasker or App Factory first. I might get to it tomorrow.

I think your project is very cool though. Seems to be working well so far!

John Spillett

unread,
Feb 27, 2015, 11:30:16 AM2/27/15
to tas...@googlegroups.com
I have managed to get rid of the application stopping in apk mode. All scene deletes ( to save memory) have been replaced with scene hide. This seems to have fixed it.

Thanks for all replies.

Sean Williams

unread,
Feb 27, 2015, 11:45:57 AM2/27/15
to tas...@googlegroups.com
That is strange. Maybe try something like,, hide scene - wait 100ms - destroy scene,, If you prefer to them destroyed

Rich D

unread,
Feb 27, 2015, 2:33:47 PM2/27/15
to Tasker Google Groups Post


> I have managed to get rid of the application stopping in apk mode. All scene deletes ( to save memory) have been replaced with scene hide. This seems to have fixed it.
>

I think you are going to want to destroy the scenes as you said to save on memory. Did you have the option to 'continue after error' checked in the destroy scene.

@Sean,  since this could pertain to this post as well.  Have you figured out a good way to destroy your scenes when the home button has been pressed?

Sean Williams

unread,
Feb 28, 2015, 6:48:25 PM2/28/15
to tas...@googlegroups.com

@Sean,  since this could pertain to this post as well.  Have you figured out a good way to destroy your scenes when the home button has been pressed?


Hi Rich,

I'll try to give my answer in a concise manner - In my opinion there is not one perfect solution to be had... but there actually doesn't need to be.

Now the unfortunately long reply 

Early on I had a strong urge to control the home key in the same way as the back key. However I eventually realised my approach was flawed and I was trying to do something Android already does. My solution came from thinking differently and understanding the problem with a different approach.

I'll try to explain. When providing my solution there are two scenarios I consider.

Kid App Scenes,
Just like a regular app the home key sends our kid app into the background ready to be displayed again exactly where we left off. At least for a while or until Android needs its RAM back at which point the app is cached or cleaned from memory. In our kid app It makes perfect sense not to worry about doing anything special after the home button is tapped, we want our app to open up where the user has left off. It is also important to note that when Android recalls our kid app from memory it does not preform the scenes launch task. The exception to wanting this behaviour occurs if you are processing something such as a low level loop. This could obviously be a battery drain so the approach here is to always build in a fail-safe to halt loops etc. We could end the loop, destroy the scene or possibly the monitor service (if required). This will of course have the effect of removing our app from memory and creating a fresh launch the next time we open up our app. The fail-safe can also apply to our next scenario a Tasker scene.

Tasker Scenes,
As for a scene displayed exclusively with Tasker the approach is a little different. This time consider we launch a Tasker scene and then we home tap where does our scene go? Android doesn't process it the same because its something within Tasker. The next time we launch our Tasker scene we might have some trouble, why? because our scene was left in an unusual state. Create scene may fail because the scene is already created. Processing certain scene elements may fail or have adverse effects. Anyway you get the idea. Unlike a kid app, launching a scene within Tasker will always start with your scenes launch task. So the solution here is to simply always start fresh. Have a destroy scene as your first action (continue after error) this way you always know you are going to set the scene up correctly from fresh. Now this part actually also applies to the kid app because if Android has cached or killed your app then your launch task is used to reopen your app showing the correct setup each time.

Now I know this may not answer the question, 'How do you destroy a scene after a home tap?'. But in reflection the answer is the home key never expects to destroy the scene (or kid app) it simply passes management to Android so Tasker background scenes in effect are just an anomaly. For the purpose of destroying and clearing memory this is what the back key is intended for, if a user uses the back key they should expect your app to clean up as much as possible or depending on its function to be destroyed from memory. 

Rich D

unread,
Feb 28, 2015, 7:35:29 PM2/28/15
to Tasker Google Groups Post


> Hi Rich,
>
> I'll try to give my answer in a concise manner - In my opinion there is not one perfect solution to be had... but there actually doesn't need to be.
>
> Now the unfortunately long reply 
>

Great reply!!  I will be saving that one ... Thank you for taking the time to spell that out.

That all makes perfect sense..

John Spillett

unread,
Mar 3, 2015, 6:06:31 AM3/3/15
to tas...@googlegroups.com
Many thanks for this. I will change tack and work with Android!
Reply all
Reply to author
Forward
0 new messages