Getting the Foreground Activity of any application in a Service written in other application

517 views Asked by At

What I want is that I need the reference to the current Activity of ANY application that is on the foreground.

Basically I have written a service and I want to get the reference to the "current" foreground activity in that service. With "current" I mean any application activity other than the one that has started that service.

1

There are 1 answers

0
CommonsWare On BEST ANSWER

What I want is that I need the reference to the current Activity of ANY application that is on the foreground.

That is not possible. Other applications are running in other processes; you do not have access to Java objects, such as Activity instances, in those processes.