5

I've been using an Accessibility service for a while now on my app. It used to work fine, but there's this message on the phone at the screen where you enable the service in Settings that says This service is malfunctioning.

Now all of a sudden my service isn't working too well. I turn it on but doesn't work, and when I check it's just not on. It doesn't give any error on Android studio and on the phone it just shows the service as "ON" even if it's not working.

Is there a way for me to find out what is it that's making it malfunction? I have no way of knowing where to look.

Stasky
  • 107
  • 1
  • 5
  • 1
    Does this answer your question? [How to check if accessibility service crashed (Android Pie now displays this info in settings)?](https://stackoverflow.com/questions/55061568/how-to-check-if-accessibility-service-crashed-android-pie-now-displays-this-inf) – Lynch Chen Jan 22 '22 at 20:44
  • @LynchChen this gives me ideas to detect if the service stops working (I'm doing something similar already), but I don't see how I can detect why it stops working or what causes these bugs. – Stasky Jan 25 '22 at 16:30
  • 1
    the reason is very simple. The only reason is the battery saving or optimization feature implemented by the phone manufacturer. This forces the app to be terminated and cause this bug. You shouldn't experience this bug on a pure AOSP system. – Lynch Chen Jan 26 '22 at 11:44
  • 1
    @LynchChen But I've had this happen right after I turn it on, which makes me think it's something from my app that crashes it, but I see nothing in the logs. I have to keep turning on and off until it works, sometimes the first time, sometimes the third, but nothing ever shows in the logs – Stasky Jan 26 '22 at 15:29
  • 1
    It is not from your app. After your app is terminated by the system. The next time you try to enable accessibility service, it always fails to start accessibility service. It is a bug of android. Android fails to start the accessibility service after the service is terminated. There's nothing you can do with this. Someone has already filed a bug report to Google in 2016, but it hasn't been fixed. Check this out: https://issuetracker.google.com/issues/37123359 – Lynch Chen Jan 27 '22 at 02:20

0 Answers0