是否有 adb/shell 命令列出 android 的通知栏上的项目?
Is There an adb/shell command to list the items on the android's notification bar?
谁能告诉我是否有办法获取通知栏中当前显示的项目的完整列表?我正在尝试编写一个界面,该界面将根据发出通知的特定应用程序向我的 PC 触发通知。
我使用 adb cli 工具进行类似操作的唯一结果是 Receiving push notifications using adb shell command,它似乎试图从特定应用程序获取通知。
我找到的其他参考资料与实际 android 编程和向栏发送您自己的通知有关。
为了格式化,我重复我对 fRoStBiT 的评论,fRoStBiT 在他的回答中提供了资源。以下 cli 提供了特定项目:
$ adb shell dumpsys notification | egrep NotificationRecord | awk -F\| '{print }'
您可以使用
adb shell dumpsys notification
它显示有关当前显示的通知的详细信息。
adb shell dumpsys notification | grep ticker | cut -d= -f2
向我展示了屏幕文本的一些描述。
tickerText
似乎是包含通知文本的 属性 的名称
在 Android >= 6 上获取额外通知使用此命令
adb shell dumpsys notification --noredact
您可以在 extras
部分看到的完整通知文本:
extras={
android.title=String (Bring The Rain)
android.reduced.images=Boolean (true)
android.subText=null
android.template=String (android.app.Notification$MediaStyle)
toSingleLine=Boolean (false)
android.text=String (Upon A Burning Body)
android.appInfo=ApplicationInfo (ApplicationInfo{c8165e6 org.telegram.messenger})
android.showWhen=Boolean (false)
android.largeIcon=Icon (Icon(typ=BITMAP size=100x100))
android.mediaSession=Token (android.media.session.MediaSession$Token@608a746)
gameDndOn=Boolean (false)
android.compactActions=int[] (3)
[0] 0
[1] 1
[2] 2
}
谁能告诉我是否有办法获取通知栏中当前显示的项目的完整列表?我正在尝试编写一个界面,该界面将根据发出通知的特定应用程序向我的 PC 触发通知。
我使用 adb cli 工具进行类似操作的唯一结果是 Receiving push notifications using adb shell command,它似乎试图从特定应用程序获取通知。
我找到的其他参考资料与实际 android 编程和向栏发送您自己的通知有关。
为了格式化,我重复我对 fRoStBiT 的评论,fRoStBiT 在他的回答中提供了资源。以下 cli 提供了特定项目:
$ adb shell dumpsys notification | egrep NotificationRecord | awk -F\| '{print }'
您可以使用
adb shell dumpsys notification
它显示有关当前显示的通知的详细信息。
adb shell dumpsys notification | grep ticker | cut -d= -f2
向我展示了屏幕文本的一些描述。
tickerText
似乎是包含通知文本的 属性 的名称
在 Android >= 6 上获取额外通知使用此命令
adb shell dumpsys notification --noredact
您可以在 extras
部分看到的完整通知文本:
extras={
android.title=String (Bring The Rain)
android.reduced.images=Boolean (true)
android.subText=null
android.template=String (android.app.Notification$MediaStyle)
toSingleLine=Boolean (false)
android.text=String (Upon A Burning Body)
android.appInfo=ApplicationInfo (ApplicationInfo{c8165e6 org.telegram.messenger})
android.showWhen=Boolean (false)
android.largeIcon=Icon (Icon(typ=BITMAP size=100x100))
android.mediaSession=Token (android.media.session.MediaSession$Token@608a746)
gameDndOn=Boolean (false)
android.compactActions=int[] (3)
[0] 0
[1] 1
[2] 2
}