0

I need a way to detect the active Activity without pooling.

The right way is to have a Service that listens for Activities launching in a continuous way.

BUT, I do not want to do pooling since it drains the battery. I have tried READ_LOGS permission, but it seems that I have to have ROOT access, which I do not have/need.

I am thinking that I need a kind of Broadcast Receiver and listen for Apps changes like this:

ActivityChangerBroadcast extends BroadcastReceiver{
    @Override
    public void onReceive(Context context, Intent intent) {
        try {

        } catch (Exception e) {

        }

    }
}
daedsidog
  • 1,732
  • 2
  • 17
  • 36
Duna
  • 1,564
  • 1
  • 16
  • 36

1 Answers1

1

I found the answer after doing couple of days of research. It is possible!

The entry key is using: AccessibilityService class service and register for "Retrieve Window Content" permissions.

Duna
  • 1,564
  • 1
  • 16
  • 36