Newbie question: global variables

28 views
Skip to first unread message

Алексей Рукин

unread,
Mar 14, 2026, 5:33:31 AM (11 days ago) Mar 14
to Automate for Android
Is it possible to implement "global" variables, like in Macrodroid? For example, a setting that can be used in many flows, not just in one.

Henrik "The Developer" Lindqvist

unread,
Mar 14, 2026, 10:15:26 AM (10 days ago) Mar 14
to Automate for Android
Store such "global" data in a file or database.

Алексей Рукин

unread,
Mar 14, 2026, 6:32:43 PM (10 days ago) Mar 14
to Automate for Android
No easier way? I could understand storing a large array or dictionary in a JSON encoded file, but not a simple variable such as the current sound mode or the last reboot time.

Henrik "The Developer" Lindqvist

unread,
Mar 14, 2026, 10:25:04 PM (10 days ago) Mar 14
to Automate for Android
No, since "global variables" are not unique so could cause "bug" if multiple flows used the same variable (name) of different purposes.
They could also cause concurrency problems if its value was unexpectedly changed by another flow.
They're considered bad practice hence i've not implemented them, please read: here, here.
Reply all
Reply to author
Forward
0 new messages