termux / termux-api

Termux add-on app which exposes device functionality as API to command line programs.
https://f-droid.org/en/packages/com.termux.api/
2.31k stars 457 forks source link

termux-notification: Get current notifications #110

Closed tajnymag closed 5 years ago

tajnymag commented 7 years ago

Would it be possible to query for currently displayed notifications?

It could work as follows:

termux-notification-get --json

Result:

{
{"appid":"com.facebook.mlite","title":"John Doe","content":"Some content of the notification"},
{"appid":"com.maxmpz.audioplayer","title":"After the Storm","content":"Name of a song fex."}
}
vovcacik commented 6 years ago

Meanwhile one can grab some data from dumpsys notification (root shell required).

tajnymag commented 6 years ago

Interesting, but that doesn't contain whole content of the notifications. Try grepping the output of "dumpsys notification" with content from Termux's permanent or Messenger's multi-line notification.

However, it's better than nothing. Thank you.

T-vK commented 5 years ago

Any news on this? I see there has been a related PR?

SwapnilSoni1999 commented 5 years ago

It says command not found for termux-notification-get

xalexalex commented 5 years ago

@T-vK @SwapnilSoni1999 The functionality is available in termux/termux-api thanks to #210 , but someone must implement it in termux/termux-api-package. Meanwhile from within termux you can use /data/data/com.termux/files/usr/libexec/termux-api NotificationList after granting Termux:API notification access (in android Pie: settings -> apps & notifications -> special app access -> notification access).

SwapnilSoni1999 commented 5 years ago

@xalexalex thanks alot ❤️

fornwall commented 5 years ago

Fixed in version 0.44 of the termux-api package!

Benjamin-Loison commented 2 years ago

Just to let the issue readers know: the command is termux-notification-list.

nozwock commented 8 months ago

Is there a way to retrieve information about the notification's actions?