Trigger accessibility services

Carl Zyex

New member
From time to time MD accessibility services are switched off, in my system (Xiaomi 11, android 11), don't know why. Then, I have a simple macro to switch them back on, if I note they are off, using an Accessibility Service Action.
My point is how to automate this. What trigger could I invoke to run my macro? Is there any secure setting command state i could refer to in order to verify services on/off and use it as a trigger for the macro?
 

hsurB

Well-known member
Maybe macrodroid system log change? I believe it appears there as soon as it detects they stopped working.
How would you create macro to turn them back on when I believe You would need them enabled to perform ui interactions actions tho?
 
Last edited:

Jacob L

Moderator (Lawsonator)
From time to time MD accessibility services are switched off, in my system (Xiaomi 11, android 11), don't know why. Then, I have a simple macro to switch them back on, if I note they are off, using an Accessibility Service Action.
My point is how to automate this. What trigger could I invoke to run my macro? Is there any secure setting command state i could refer to in order to verify services on/off and use it as a trigger for the macro?
There is a setting in MacroDroid to do this for you.
 

Carl Zyex

New member
Jacob you mean "Keep accessib..." in the Settings, right?
I know it and I keep services enabled there, but, somehow, they keep switching off from time to time . Then my macro is a secure way to reenable without having to restart the phone.
 

Endercraft

Moderator (& bug finder :D)
Jacob you mean "Keep accessib..." in the Settings, right?
I know it and I keep services enabled there, but, somehow, they keep switching off from time to time . Then my macro is a secure way to reenable without having to restart the phone.
Try MacroDroid initialisated : if they are switched off that means MacroDroid has been killed by system (unless another macro/app is disabling them). You could try and search logcat for accessibility events (for example in shell script : logcat | grep accessibility)
 

Dimlos

Well-known member
Perhaps MacroDroid's functionality is not detectable.
You can force accessibility to be switched off and restarted by changing the system settings.
Running this macro regularly would prevent accessibility from being switched off.
 

Attachments

  • Macro.jpg
    Macro.jpg
    336 KB · Views: 15
  • System Setting.jpg
    System Setting.jpg
    333.1 KB · Views: 17

Carl Zyex

New member
I don't think MD is being killed by the system, and I have no disabling macro either.
I'll concentrate on the logcat trigger, thanks, I'll give feed back
 

Dimlos

Well-known member
Is there any way to know when accessibility was turned off?
Unless you are logging at that point, I don't think you can figure that out.
 

sampleuserhere

Active member
If the service is simply turned off, the service will not be found in the enabled_accessibility_service entry. MD has a trigger to monitor secure setting changes, you may be able to work this one out with that. Though I believe MD already handles this one with its setting.

It's a different matter if its state is "Not Working" even when the service is clearly set to turned on. If this is the one you're facing, then it's really nasty one. You can read below link for further context, Termux dev wrote about this matter in r/tasker.

https://www.reddit.com/r/tasker/comments/sz2kg7
The fool proof method is to always restart the service everytime the screen is turned on, or when webview dependency package (known lead) is updated.

Edit:

This issue was fixed on 12L.
 
Last edited:

Endercraft

Moderator (& bug finder :D)
What I do is turn off and on accessibility when MacroDroid starts. This has worked for months without any issue - especially when I have to kill Google play services because webhook breaks.
Using the command in the r/tasker link I found this - I had already noticed it was a dependency before running this.
Screenshot_2023-09-30-11-55-00-146_com.termux-edit.jpg
 

sampleuserhere

Active member
What I do is turn off and on accessibility when MacroDroid starts. This has worked for months without any issue - especially when I have to kill Google play services because webhook breaks.
Using the command in the r/tasker link I found this - I had already noticed it was a dependency before running this.
View attachment 6931

Oh yeah, I forgot that was actually dependency issue, not just specifically to webview.
 

vm53

Member
Perhaps MacroDroid's functionality is not detectable.
You can force accessibility to be switched off and restarted by changing the system settings.
Running this macro regularly would prevent accessibility from being switched off.
Hi everyone, I also have this problem that accessibility services for macrodroid often appear "Not Working"
So the macro example posted by @Dimlos seemed like an excellent idea to me, but it doesn't seem to work to me, in fact the text I attach below appears in the helper.
Any ideas to fix the error? Thank you in advance
 

Attachments

  • 01.jpg
    01.jpg
    87.4 KB · Views: 12

Endercraft

Moderator (& bug finder :D)
Hi everyone, I also have this problem that accessibility services for macrodroid often appear "Not Working"
So the macro example posted by @Dimlos seemed like an excellent idea to me, but it doesn't seem to work to me, in fact the text I attach below appears in the helper.
Any ideas to fix the error? Thank you in advance
Seems like you are trying to set the setting as integer or decimal. Make sure it is string type.
 

vm53

Member
Seems like you are trying to set the setting as integer or decimal. Make sure it is string type.
Thanks for the answer, but I don't understand what you mean by decimal or integer, I simply copied @Dimlos's macro Post @Dimlos
and it doesn't seem like there are deciamles or integers to insert, unless something is missing in the macro, to which I ask @Dimlos to post it in full.
Thanks again

001.jpg002.jpg
 

Dimlos

Well-known member
Please set up Keep Accessibility Services Running in MacroDroid before running it.
ADB Hack of the helper is required because it is a change of the system setting using the helper.
 

Attachments

  • Accessibility_reboot.macro
    1 KB · Views: 9

Dimlos

Well-known member
I can confirm that it is working in the system log in my environment.
 

Attachments

  • System Log.jpg
    System Log.jpg
    479.1 KB · Views: 7

vm53

Member
I can confirm that it is working in the system log in my environment.
Thank you very much, it works perfectly.
It's totally my fault, I didn't understand @Endercraft's
suggestion regarding the string instead of integer.
Attached is my error

04.jpg
 
Last edited:
Top