abc

🏠 📩 📨Blog

Launching Tasks from Samsung Sidebar

The Samsung sidebar is great, and I use it to launch a few Tasker Tasks. You can’t add Tasker shortcuts there, so you have to compile a task into an app using the Tasker App Factory. However, such apps are sandboxed away from the normal Tasker environment, and thus for example, cannot see the normal global variables. The solution is to have an app containing just one action.

Send Intent [ Action:uk.me.stevewaring.intent.RUNTASK Extra:task:mytask ]

I have a profile that listens for that intent and runs the following task:

Perform Task [ Name:%task ]

This way, the tiny app that I have pinned to the sidebar can fire off any task in the normal tasker environment.

Replacing Text

When you have number of search replacements to make to the same variable, it can be a lot less cluttered to use JavaScript. The following code escapes any html tags in a variable, so that it can be displayed in a scene.

mydata = mydate.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/ /g, " &nbsp;").replace(/\n/g, "<br>");

Detecting Empty Scene Text Edit Elements

When you have a text edit element in a scene, it’s not obvious how to test if it’s empty. You could test its value against %varname, but what if that is what was entered into the field? JavaScript to the rescue. If you assign the element’s value to a different variable in JavaScript and then test the two values, if they are the different then the field is not set. The following code is in a scene element’s Text Changed task. It runs a new task if the text element changes from empty to having text or vice versa.

JavaScriptlet [ Code:var testn = new_val; var testo = old_val; ] Perform Task [ Name:Validate Scene ] If [ %testn eq %new_val X| %testo eq %old_val ]

Controlling a Samsung LED case

For years now Samsung have made led cases for their phones. These flash up an icon when there is a call from a specific contact (you can accept or reject the call by swiping the case), and also flash when there is a notification from a chosen app. As well as a range of animated icons to choose from, you can create your own icons with an app that is supplied. Sadly, Samsung have never developed the case to its full potential. There is no API, and you can’t refine the notification response by notification category.

This means that, by default, you can only choose one icon for notifications from Tasker. However there is a simple way around this. Create a Tasker task that issues a notification, waits four seconds, and then cancels the notification. Use the normal Tasker notification for this, not the Auto Notification plugin. Compile this into an app using the Tasker App Factory. You can now assign an icon to this app in the Led Icon Editor app. You can now start this app from Tasker to flash your chosen icon. When you want to be able to flash a different icon, recompile the app to a different package name. You can assign a different icon to this app and then start the new app in Tasker when you want the different icon shown.

I use these to show who has sent me a txt or WhatsApp message and for some browser notifications.