Is it possible to somehow catch (for example, the Receiver) that such and such an application was launched, or such an application was closed, or such an application was opened with such an Activity? Perhaps there is a system intent? As an extreme option, you can parse logcat. There is some information from ActivityManager:
Process com.DefiantDev.SkiSafari (pid 21119) has died. START {act=android.intent.action.MAIN cmp=ru.imholynx.simplecase/.MainActivity (has extras)} from pid 21366
But if you know a simpler version, I will be grateful if you tell.