Title: Notify when any app launched irrespective of launcher app we are using
Tags: android;android-intent;android-activity;android-framework
Question: How can i notify or know when any android app get launched?

If i want to know the app launch state i can know if i put log in package/apps/launcher/...../Launcher.java, but control do not come here if we are using another launcher app.
I searched a lot but i did not find solution. They are saying we can not get app launch events in android.

Please tell me the process in framework when any app launched or resumed or destroyed.
I have seen some solution like reading Log, but that is restricted from jellybean and that is not at all my intention
Apps like app lock are doing this work even in Jellybean,kitkat and higher
Any help would be appreciated.




{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:03/12/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<android><android-intent><android-activity><android-framework>', 'Title': 'Notify when any app launched irrespective of launcher app we are using', 'ViewCount': 94, 'id': 29006878, 'user_AboutMe': None, 'user_AccountId': 3200728.0, 'user_DisplayName': 'user2702818', 'user_Reputation': 31.0, 'user_Views': 11.0, 'user_id': 2702818.0}}