Automatically log Android lifecycle events using ActivityLifecycleCallbacks?

I don’t have any firsthand experience but judging from the API you can just write your own class that implements the Application.ActivityLifecycleCallbacks interface and register that class on the provided Application class instance

getApplicaton().registerActivityLifecycleCallbacks(yourCustomClass);

This class will receive the same callbacks as your individual activities. Good luck.

PS. This is API level 14 btw, so it won’t work on older phones.

Leave a Comment