Android 4.3 and above allows access to a list of historical notifications using the Settings widget. The scope of "historical" is limited to current session of Android and the list is populated with new entries once the system is rebooted.
(Click image to enlarge)
So, where does this notification log is stored in Android?
I had no luck finding anything good named "notification". I already did a system-wide search with nothing positive to report here.
find / -iname "*notification*"
I watched the real-time output of
adb logcat -v long(tried with explicit root access as well) but there was no common event when a notification popped up in notification drawer. I was monitoring the ping request (shows up as a notification) to KDE Connect sent from my Slackware Linux, for the test case.
The entries that are visible in Notification drawer can be traced back to the output of
adb shell dumpsys notification
As said, you get the current ones but not the historical ones.
The real name or codename (I suppose) of
android.app.INotificationManager. I attempted to dive into its source code and there is nothing positive to report. It is very likely that being not a programmer, I might have missed a thing or two of importance.
I, while being reluctant for being illogical, did peek into the data directory of Settings (
com.android.settings) and Settings Storage (
com.android.providers.settings) apps. Nothing interesting there.
I presume that either the log is managed in the memory by a program or at some location in storage where the logs are frequently flushed after current Android session ends. I've no idea what I'm talking here.
I've the Notification access to Tasker under Settings → Notification manager already enabled. So that's definitely not the roadblock here.
(Asked by Lucky) The intent associated with that Notification log window accessible through Settings widget has the following things:
- I've a rooted OnePlus One running COS12 (Xposed Framework installed) and many Android 5.1 ROMs.
- I'm absolutely aware about many apps which can record notifications and lets you see them. But as you would've guessed by now, I'm not interested in futuristic past but the past related to present moment. In short, I want access to native raw files or logs to see both the historical and current notifications without depending on third-party apps.
Notifications for other users do not appear until they are active.
But you can still see those new notifications in the output of
adb shell dumpsys notification. So I want to access the logs directly to make my task(s) work, thereby removing the dependence on notifications showing up in Notification drawer.