Activation on boot?

439 views
Skip to first unread message

Mikael Folkesson

unread,
Nov 25, 2013, 11:55:02 PM11/25/13
to tas...@googlegroups.com
Hi, is there a way to get an app built in Tasker and the app factory to look for device boot and perform an action when booting the phone?
That is, without using Tasker to trigger a profile to launch the app, but that the app itself will do this?

Bob Hansen

unread,
Nov 26, 2013, 12:30:50 AM11/26/13
to tas...@googlegroups.com
Create your profile with context > system >device boot and/or use Tasker built-in variable %UPS.

Mikael Folkesson

unread,
Dec 5, 2013, 2:22:22 AM12/5/13
to tas...@googlegroups.com
Thank you, I finally got the time to try to implement it, but it doesn't seem to be working. Sure it should trigger for a separate app built using Tasker app factory? If not, is there any other way?
I used the context, and in the task I used UPS to check if it is being run at boot or not. Maybe there's a more elegant solution for checking this too?

Mikael Folkesson

unread,
Dec 8, 2013, 8:04:30 AM12/8/13
to tas...@googlegroups.com
I checked in the Autostarts app, and saw that the app I exported from Tasker is registered for starting up at system boot, but it doesn't seem to run (as I've added a debug alert in the beginning, so it should say that it's running).
Do I have to set some special kind of permission for the app when exporting it, for it to be able to start at boot?

Pent

unread,
Dec 8, 2013, 12:29:34 PM12/8/13
to tas...@googlegroups.com

Do I have to set some special kind of permission for the app when exporting it, for it to be able to start at boot?

It should be added if you have a profile in the project.

You can look at what permissions have been added by clicking the manifest icon at the bottom of the dialog after generation.

Pent

Mikael Folkesson

unread,
Dec 9, 2013, 12:10:11 AM12/9/13
to tas...@googlegroups.com
Ok, thank you very much! Here's what I found:

<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Should there be something else in there for it to run?

The intent receiver is specified as such, here boot is mentioned at least:

<intent-filter>
<action android:name="net.dinglisch.android.tasker.WILLYUM" />
<action android:name="net.dinglisch.android.tasker.AWAKEY" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>

Pent

unread,
Dec 9, 2013, 2:07:59 AM12/9/13
to tas...@googlegroups.com
Hmm, there should be:

 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Could you export your project description (not XML) and post it here ?

I don't see from the code how the permission could be missing if you have at least one
profile in your project.

Thanks,

Pent

Pent

unread,
Dec 9, 2013, 2:08:41 AM12/9/13
to tas...@googlegroups.com
Could you also post your Tasker version ?

Thanks,

Pent

Mikael Folkesson

unread,
Dec 10, 2013, 12:15:47 AM12/10/13
to tas...@googlegroups.com
Ok, thank you, no problem:
Minfree (14)
A1: If [ %UPS > 200 ]
A2: Show Scene [ Name:Minfree Splash Display As:Dialog, Dim Behind Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Continue Task Immediately:On ]
A3: Else
A4: Notify [ Title:Minfree Run Text:Minfree run at boot Icon:null Number:0 Permanent:Off Priority:3 ]
A5: End If
A6: Variable Clear [ Name:%MemFileExist1 Pattern Matching:Off ]
A7: List Files [ Dir:Minfree Match:minfree.pref Include Hidden Files:Off Variable:%MemFileExist Continue Task After Error:On ]
A8: If [ %UPS > 200 ]
A9: Create Scene [ Name:Memory Killer Continue Task After Error:On ]
A10: End If
A11: If [ %MemFileExist1 Is Set ]
A12: Element Visibility [ Scene Name:Memory Killer Element Match:Image1 Set:True Animation Time (MS):0 ]
...
A17: Else
A18: Element Visibility [ Scene Name:Memory Killer Element Match:Image1 Set:False Animation Time (MS):0 ]
...
A26: If [ %UPS > 200 ]
A27: Hide Scene [ Name:Minfree Splash Animation:System ]
A28: Show Scene [ Name:Memory Killer Display As:Dialog, Dim Behind Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Continue Task Immediately:Off ]
A29: Return [ Value:0 Stop:On ]
A30: Else
<Set minfree>
...
A32: Notify [ Title:Minfree Run Text:Minfree run and finished at boot Icon:null Number:0 Permanent:Off Priority:3 ]
A33: Return [ Value:0 Stop:On ]
A34: End If

4.2u3 is the tasker version btw.
How to add a profile to the project by the way? What I did was to create a profile that triggers the task, then exporting the task.

Pent

unread,
Dec 10, 2013, 1:40:31 AM12/10/13
to tas...@googlegroups.com
You have no device boot profile.


>How to add a profile to the project by the way?



> What I did was to create a profile that triggers the task, then exporting the task.

That's not going to get the profile in the kid.

Pent

Mikael Folkesson

unread,
Dec 10, 2013, 4:19:38 PM12/10/13
to tas...@googlegroups.com
Ah, ok, thanks, forgot about projects.
So, I made a project, and it did actually run at boot once, then compiled it again, but then it didn't work at all. Undid the changes, but still doesn't work. Any idea what it could be?
Here's a new description:

Profile: Minfree At Boot (72)
Notification: no
Event: Device Boot
Enter: Minfree (14)
A1: If [ %LaunchCount ! Set ]
A2: Create Directory [ Dir:Minfree Create All:Off Use Root:Off Continue Task After Error:On ]
A3: Variable Set [ Name:%LaunchCount To:1 Do Maths:Off Append:Off ]
A4: End If
A5: If [ %UPS > 200 ]
A6: Show Scene [ Name:Minfree Splash Display As:Dialog, Dim Behind Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Continue Task Immediately:On ]
A7: Else
A8: Notify [ Title:Minfree Run Text:Minfree run at boot Icon:null Number:0 Permanent:Off Priority:3 ]
A9: End If
A10: Variable Clear [ Name:%MemFileExist1 Pattern Matching:Off ]
A11: List Files [ Dir:Minfree Match:minfree.pref Include Hidden Files:Off Variable:%MemFileExist Continue Task After Error:On ]
A12: If [ %UPS > 200 ]
A13: Create Scene [ Name:Memory Killer Continue Task After Error:On ]
A14: End If
A15: If [ %MemFileExist1 Is Set ]
A16: Element Visibility [ Scene Name:Memory Killer Element Match:Image1 Set:True Animation Time (MS):0 ]
A17: If [ %UPS > 200 ]
A21: Else
A22: Read File [ File:Minfree/minfree.pref To Var:%Temp ]
A26: End If
A27: Else
A28: Element Visibility [ Scene Name:Memory Killer Element Match:Image1 Set:False Animation Time (MS):0 ]
A32: End If
A36: If [ %UPS > 200 ]
A37: Hide Scene [ Name:Minfree Splash Animation:System ]
A38: Show Scene [ Name:Memory Killer Display As:Dialog, Dim Behind Horizontal Position:100 Vertical Position:100 Animation:System Show Exit Button:Off Continue Task Immediately:Off ]
A39: Disable
A40: Return [ Value:0 Stop:On ]
A41: Else
A42: Notify [ Title:Minfree Run Text:Minfree run and almost finished at boot Icon:null Number:0 Permanent:Off Priority:3 ]
<Set minfree>
A44: Notify [ Title:Minfree Run Text:Minfree run and finished at boot Icon:null Number:0 Permanent:Off Priority:3 ]
A45: Disable
A46: Return [ Value:0 Stop:On ]
A47: End If

Pent

unread,
Dec 11, 2013, 2:04:26 AM12/11/13
to tas...@googlegroups.com
That's a complicated task.

Try testing with something like a Flash or Notify action (only) instead.

Pent

Mikael Folkesson

unread,
Dec 23, 2013, 12:58:47 AM12/23/13
to tas...@googlegroups.com
Ok, I now created a new task in a new project, which only displays a notification, and it works.

I also changed the boot task in the app I'm making to do just the same, disabled the launch of the main task in the boot task, so it now only is supposed to show a notification (and after that to set a variable). But it doesn't work. Could it be something with multiple tasks in the APK?

Pent

unread,
Dec 23, 2013, 2:33:26 AM12/23/13
to tas...@googlegroups.com

Ok, I now created a new task in a new project, which only displays a notification, and it works.

I also changed the boot task in the app I'm making to do just the same, disabled the launch of the main task in the boot task, so it now only is supposed to show a notification (and after that to set a variable). But it doesn't work. Could it be something with multiple tasks in the APK?


I didn't understand all that main-task-boot-task stuff. Start from your working thing, add other things one at a time until
it doesn't work.

Pent

Mikael Folkesson

unread,
Jan 5, 2014, 6:52:56 PM1/5/14
to tas...@googlegroups.com
I've tried to do it now, but I need to distinguish between when the app is run at boot and when not.

It looks like this, there is a task triggered at boot that sets a variable that it was launched at boot, which then launches the main task.

Profile: Minfree At Boot (72)

Event: Device Boot
Enter: Minfree Boot (67)
A1: Variable Set [ Name:%RunOnBoot To:1 Do Maths:Off Append:Off ]
A2: Notify [ Title:Testing Text:Minfree Boot task entered Icon:null Number:0 Permanent:Off Priority:3 ] (This shows up at boot in Tasker, but not in the exported app)
A3: Perform Task [ Name:Minfree Stop:On Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]

Minfree (14)
Abort Existing Task


A1: If [ %LaunchCount ! Set ]
A2: Create Directory [ Dir:Minfree Create All:Off Use Root:Off Continue Task After Error:On ]
A3: Variable Set [ Name:%LaunchCount To:1 Do Maths:Off Append:Off ]
A4: End If

A5: If [ %RunOnBoot ~ 1 ]
A17: Notify [ Title:Minfree Run And Finished Text:Minfree run and finished at boot Icon:null Number:0 Permanent:Off Priority:3 ]
A18: Return [ Value:0 Stop:On ]
A19: End If
(Irrelevant parts here)
A44: Return [ Value:0 Stop:On ]

This works fine when in Tasker, all notifications show up, and all rows are executed as they should.
But when exporting the same project as an app, nothing happens at boot. Are any settings wrong? The app is registered for device boot, so the notification in the entry tasks should show up at least.

Mikael Folkesson

unread,
Jan 5, 2014, 7:25:10 PM1/5/14
to tas...@googlegroups.com
I also created another project to test, it basically does the same, it's triggered by device boot, and displays a notification.
This works also when exported as an app, it runs as expected at boot.
Then I added another task to the project, which is launched from the boot task, and all it does is to flash an alert. Then it only displayed the notification from the first task, not the second, but it did run. I find it peculiar, since this test project and my main project in the previous post basically have the same structure.

For some reason Tasker didn't let me export the profile description, but I'll paste the tasks anyway:

TestBoot (82)
A1: Flash [ Text:Test at boot Long:Off ]
A2: Notify [ Title:Test Text:Test vid boot Icon:null Number:0 Permanent:Off Priority:3 ]
A3: Perform Task [ Name:Extra Task Stop:On Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ]

Extra Task (87)
A1: Flash [ Text:Extra Task, doesn't do anything Long:Off ]

Pent

unread,
Jan 6, 2014, 2:00:53 AM1/6/14
to tas...@googlegroups.com
Are you using Tasker 4.2u3 from Play Store ? And the latest App Factory version ?

Which Android version is on the device ? Is it a custom ROM ?

Pent

Mikael Folkesson

unread,
Jan 7, 2014, 12:22:38 AM1/7/14
to tas...@googlegroups.com
According to the app it's 4.2u3m, from the play store, and the app factory is the latest one aswell, to match.

I'm on a note 2, recently upgraded to 4.3 by flashing Omega ROM 21. Previously I was on Omega ROM 18 with Android 4.1.2, both very stable roms.

It has been exactly the same problem irrespective of Android versions.

Pent

unread,
Jan 7, 2014, 1:03:55 AM1/7/14
to tas...@googlegroups.com
I put your TestBoot and Extra Task, and a Device Boot event into a project and exported it as an app, it worked correctly. The second flash was also shown.

You say 'only the first notification was shown', but there is no notification in the second task you gave, only a Flash.

Pent

Reply all
Reply to author
Forward
0 new messages