Have Tasker backup Global Variable Values when doing a standard backup.

This is a pretty obvious one, even if it has to generate a separate file, which would be a good additional option anyways.

Right now there is no direct way to backup/restore Global Variable names and values in native Tasker. A workaround exists via a "Global Variable Backup Task" posted on reddit a while back, but this should really be baked into Tasker to begin with.

7 replies

Do you know why this doesn't happen yet? :) Was it an oversight or on purpose? Do you know? Thanks!

I think it began as an oversight, but then never added as feature. It should be added :)

I think it would require generating an additional file, although I think it could just as easily be a section in the main xml.

When doing a full backup there could likely be a checkbox option for "Backup User Global Variables" so the user has the choice.

I think Pent never added this as it makes little sense. A variable is something that changes. When the task is first run after a restore, the variables should be populated with up to date data as long as the task works correctly. Backing up information that is going to be refreshed on first use is a waste of time and resources.

The observation that these are "variables" and thus should always be set based on current information is flawed. The need to restore certain values to variables is because they are more like "constants", but Tasker has no constants. Using variables avoids in-line constant values being inserted multiple times in the tasks themselves, and presenting a serious problem should they need to be updated. Such constants consist of settings such as frequently used WiFi networks, timeouts, storage folders, calendar names or events, and so on. Things that rarely change, but can change when a new WiFi access point is used, moving to a new home, purchasing a new mobile device, and starting a new job. The only alternative I can think of is a task that initializes all the settings represented by the constant "variables", but such task would need to be device specific, making it too complicated, compared to have a file or folder that can be backed up and restored for each device, and used to restore all the constant "variables".

Several times I have experienced Tasker clearing all global variables. I have set up a set of tasks to initalialize all global variables so I could recover from this problem. This is also helpful when moving to a new phone. 

Having a backup of global variables is a great option for those times when disasters occur.

I see what you mean but normal process would be to write constants to a file and populate variables from that file as part of a task.

Well, the ability to restore variables from a file is 1/2 of what this request asks for, and is still lacking in Tasker, except for writing a complex custom task to do so.

I don't think there's a "normal process" to do any things in Tasker. It's the user's choice. Anytime you're doing a read/write it's extra Actions, and then you've got to deal with file management, etc.

Plus if you're storing constants in a file, then anytime you backup Tasker - you've got to backup all your Tasker-related files, which is a whole extra step, and accomplishes the same the thing as backing up Globals to begin with.

Also a large portion of Tasker users aren't programmers, and don't care about 'standard practices' as far as coding and app-building goes. They just want their Tasks to work. And usually by the simplest means required.

I would find this very helpful too.

I was not aware of the current behavior. I assumed all the things displayed on the main screen (profiles, tasks, scenes, vars) would be backed up.

I stored evolving data in the variables (aka, work went into obtaining that information and I
wanted to to automatically keep the data in those variables safe via a regular automatic backup) and now after my phone is dead, the data in those variables is gone and the backup does not have them either.

Actual example 1: Wifi/Cell Network combinations I tweaked over time

Actual example 2: A Cash-Owned reminder in a variable with a Scene with buttons to quickly add/subtract from the variable. Now I even lost money together with the variables.

There is a current work around Task, to run at anytime, or when you do your regular Tasker backup.

The Task saves Global Var names and values to a text file. There is also a Task at that link to Restore them as well.


Joao, Kindly add this feature. You've listened to us and added the Tasker Action to "Backup Tasker Data". Now we ask you to include the backup procedures for all global variables too. Thanks for reading! Love your great work on Tasker.